471,896 Members | 1,837 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,896 software developers and data experts.

Can I do a "AND NOT =" in a Regular Expression

I have an application which allows me to select records by entering a
Regular Expression in a field. With the following I can select all records
where pool = PHL-DP OR desc ends in NP, but what I need it where pool =
PHL-DP AND desc does NOT end in NP. Basically I want to exclude those
records with an NP at the end of the desc field. Can this be done with a
RE?

Thank you!
Tim

m/(^pool=PHL-DP)|(^desc=NP$)/m
Jul 19 '05 #1
1 2391
John Smith wrote:
I have an application which allows me to select records by entering a
Regular Expression in a field. With the following I can select all
records where pool = PHL-DP OR desc ends in NP, but what I need it
where pool = PHL-DP AND desc does NOT end in NP. Basically I want to
exclude those records with an NP at the end of the desc field. Can
this be done with a RE?


Should be very easy, something along the line (untested):

($pool eq 'PHL-DP' and ! $desc=~m/NP$/)

jue
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Jeff Sandler | last post: by
2 posts views Thread by John Smith | last post: by
reply views Thread by YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.