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. Advertising

  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. 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. Thomas F. O'Connell

    Negative Lookbehind and Wildcards

    Thomas F. O'Connell, Feb 27, 2004, in forum: Perl
    Replies:
    1
    Views:
    753
    Gunnar Hjalmarsson
    Feb 28, 2004
  2. Replies:
    2
    Views:
    571
  3. Gabriel Rossetti
    Replies:
    0
    Views:
    636
    Gabriel Rossetti
    Mar 31, 2009
  4. MRAB
    Replies:
    0
    Views:
    568
  5. mail
    Replies:
    0
    Views:
    108
Loading...

Share This Page