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

Discussion in 'Perl' started by John Smith, Sep 23, 2004.

  1. John Smith

    John Smith Guest

    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
     
    John Smith, Sep 23, 2004
    #1
    1. Advertising

  2. 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
     
    Jürgen Exner, Sep 25, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VSK
    Replies:
    2
    Views:
    2,400
  2. =?Utf-8?B?RWQgQ2hpdQ==?=

    Can regular expression validation do this?

    =?Utf-8?B?RWQgQ2hpdQ==?=, Nov 8, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    3,305
    Chris R. Timmons
    Nov 8, 2004
  3. ThunderMusic

    Regular expression, how can I format it?

    ThunderMusic, Feb 2, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    2,196
    =?Utf-8?B?VEg=?=
    Feb 2, 2006
  4. =?iso-8859-1?B?bW9vcJk=?=

    Matching abitrary expression in a regular expression

    =?iso-8859-1?B?bW9vcJk=?=, Dec 1, 2005, in forum: Java
    Replies:
    8
    Views:
    887
    Alan Moore
    Dec 2, 2005
  5. GIMME
    Replies:
    3
    Views:
    12,053
    vforvikash
    Dec 29, 2008
Loading...

Share This Page