Pattern matching....

Started by Steve Wolfeabout 24 years ago3 messagesgeneral
Jump to latest
#1Steve Wolfe
steve@iboats.com

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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Steve Wolfe (#1)
Re: Pattern matching....

"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

#3Steve Wolfe
steve@iboats.com
In reply to: Steve Wolfe (#1)
Re: Pattern matching....

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