pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: Resources - Regular Expressions
2+ messages / 2 participants
[nested] [flat]

* Re: Resources - Regular Expressions
@ 2002-01-15 04:45  Gurudutt <guru@indvalley.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Gurudutt @ 2002-01-15 04:45 UTC (permalink / raw)
  To: pgsql-sql

Hi!!

Thanks a lot for all the advices, I knew i could always get help from
the lists. Had festival so couldn't reply earlier and we were closed.

I have parallel question, I read about regular expressions being
faster than the 'like', is it correct and one more thing how do u
extract information from a given regular expression

eg: like in perl anything inside the () can be extracted into a
variable

like...

# Program Segment Starts here

$disksize = $1 if (/Storage Swap size:\s+([-0-9\.]+)\s+MB/);

# Program segment ends here

as u can see the '$1' has the value of the expression thats got evaluated.

Now my question is when i use the same in a SQL statement all I can
get is just a boolean value whether it evaluates to true or false ,
nothing more than that.

I would like to extract the value from the evaluated regular
expression in a SQL query

Is that possible?

Thanks in advance...


Best regards,
 Gurudutt                            mailto:guru@indvalley.com

Life is not fair - get used to it.
Bill Gates


Saturday, January 12, 2002, 2:43:13 AM, you wrote:

FB> At 03:42 PM 1/11/02 -0500, Wei Weng wrote:




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Resources - Regular Expressions
@ 2002-01-15 15:03  Jeff Eckermann <jeff_eckermann@yahoo.com>
  parent: Gurudutt <guru@indvalley.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Jeff Eckermann @ 2002-01-15 15:03 UTC (permalink / raw)
  To: Guru\(External\) <guru@indvalley.com>; pgsql-sql

Not implemented in PostgreSQL RE's AFAIK.
But you can use pl/perl to do it.  Just write a
function that takes a text type parameter (your RE
string) and returns the $1 value.

--- Gurudutt <guru@indvalley.com> wrote:
> Hi!!
> 
> Thanks a lot for all the advices, I knew i could
> always get help from
> the lists. Had festival so couldn't reply earlier
> and we were closed.
> 
> I have parallel question, I read about regular
> expressions being
> faster than the 'like', is it correct and one more
> thing how do u
> extract information fro a given regular expression
> 
> eg: like in perl anything inside the () can be
> extracted into a
> variable
> 
> like...
> 
> # Program Segment Starts here
> 
> $disksize = $1 if (/Storage Swap
> size:\s+([-0-9\.]+)\s+MB/);
> 
> # Program segment ends here
> 
> as u can see the '$1' has the value of the
> expression thats got evaluated.
> 
> Now my question is when i use the same in a SQL
> statement all I can
> get is just a boolean value whether it evaluates to
> true or false ,
> nothing more than that.
> 
> I would like to extract the value from the evaluated
> regular
> expression in a SQL query
> 
> Is that possible?
> 
> Thanks in advance...
> 
> 
> Best regards,
>  Gurudutt                           
> mailto:guru@indvalley.com
> 
> Life is not fair - get used to it.
> Bill Gates
> 
> 
> Saturday, January 12, 2002, 2:43:13 AM, you wrote:
> 
> FB> At 03:42 PM 1/11/02 -0500, Wei Weng wrote:
> 
> 
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please
> send an appropriate
> subscribe-nomail command to majordomo@postgresql.org
> so that your
> message can get through to the mailing list cleanly


__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2002-01-15 15:03 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-01-15 04:45 Re: Resources - Regular Expressions Gurudutt <guru@indvalley.com>
2002-01-15 15:03 ` Jeff Eckermann <jeff_eckermann@yahoo.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox