Thread: Pattern matching....

Pattern matching....

From
"Steve Wolfe"
Date:
  Here's a question... in Perl, I could do a pattern match like this:

 =~ /$var[A-Z]/

  In PG, I can do something similar, matching a field name:

 ~* my_field

  But how do I add the "[A-Z]" to it?

steve



Re: Pattern matching....

From
Tom Lane
Date:
"Steve Wolfe" <steve@iboats.com> writes:
>   Here's a question... in Perl, I could do a pattern match like this:
>  =~ /$var[A-Z]/
>   In PG, I can do something similar, matching a field name:
>  ~* my_field
>   But how do I add the "[A-Z]" to it?

Uh, what's wrong with

    ~* (my_field || '[A-Z]')

Or am I missing the point?

            regards, tom lane

Re: Pattern matching....

From
"Steve Wolfe"
Date:
> Uh, what's wrong with
>
> ~* (my_field || '[A-Z]')
>
> Or am I missing the point?

 DOH!

  I tried that, but had left out the parenthesis.  Thanks, Tom, for waking
me back up.

steve