Negative Lookbehind Replacement?

Discussion in 'Perl' started by mail, Feb 29, 2004.

  1. mail

    mail Guest

    Hello,

    I am trying to use regular expressions to scan a subdirectory structure and
    run sfv and parity file checks on the directory. However, I am having an issue
    with my current code using regular expressions to find par2 files. Multiple
    par2 files are created for an archive in the following format:

    test.par2
    test.vol000+01.par2
    test.vol000+03.par2
    test.vol000+07.par2
    and so on...

    I only want to select the files name "test.par2" using regular expressions.
    WSH doesn't seem to have a negative lookbehind function. Is there any regular
    expression not using a lookbehind that could get this to work?

    Thanks,
    Brian
     
    mail, Feb 29, 2004
    #1
    1. Advertisements

  2. mail <> wrote in message news:<>...
    > test.par2
    > test.vol000+01.par2
    > test.vol000+03.par2
    > test.vol000+07.par2
    > and so on...
    >
    > I only want to select the files name "test.par2" using regular expressions.
    > WSH doesn't seem to have a negative lookbehind function. Is there any regular
    > expression not using a lookbehind that could get this to work?
    >

    You don't need a regex if you're testing specifically for "test.par2".

    if ($fn == 'test.par2')

    if you MUST use a regex, you don't need a negative lookbehind:

    if ($fn =~ /^test\.par2$/)
     
    Will Stranathan, Mar 2, 2004
    #2
    1. Advertisements

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. prem_eda
    Replies:
    5
    Views:
    8,963
    Pieter Hulshoff
    Oct 11, 2004
  2. Thomas F. O'Connell

    Negative Lookbehind and Wildcards

    Thomas F. O'Connell, Feb 27, 2004, in forum: Perl
    Replies:
    1
    Views:
    905
    Gunnar Hjalmarsson
    Feb 28, 2004
  3. Replies:
    2
    Views:
    677
  4. Gabriel Rossetti
    Replies:
    0
    Views:
    752
    Gabriel Rossetti
    Mar 31, 2009
  5. mail
    Replies:
    0
    Views:
    172
  6. Isaac Councill

    negative lookbehind and \.

    Isaac Councill, Jan 10, 2004, in forum: Perl Misc
    Replies:
    1
    Views:
    219
    Malcolm Dew-Jones
    Jan 10, 2004
  7. Isaac Councill

    negative lookbehind and \. [ADDENDUM]

    Isaac Councill, Jan 10, 2004, in forum: Perl Misc
    Replies:
    0
    Views:
    163
    Isaac Councill
    Jan 10, 2004
  8. Peng Yu

    Negative Lookbehind and Wildcards

    Peng Yu, Jun 13, 2010, in forum: Perl Misc
    Replies:
    3
    Views:
    384
    C.DeRykus
    Jun 14, 2010
Loading...