Negative Lookbehind Replacement?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mail

    Negative Lookbehind Replacement?

    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

  • Will Stranathan

    #2
    Re: Negative Lookbehind Replacement?

    mail <mail@mail.co m> wrote in message news:<b3c459830 d876dc66ace6a8d 10deb72b@news.t eranews.com>...[color=blue]
    > 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?
    >[/color]
    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$/)

    Comment

    Working...