in reply to Re: Regex lookahead, lookbehind
in thread Regex lookahead, lookbehind
Thank you very much choroba. This works !!!
One last thing I need to extend to below match also
foo_bar_foo10.1.1.1.TEST.txt foo_test_foo10.1.1.1.foo10.1.1.1.TEST_test.txt foo_test_foo10.1.1.1.foo10.1.1.1.txt foo_test_foo10.1.1.1.foo10.1.1.1.TEST-1.txt
Third string is not a correct match but this is displayed as "Ok" whereas fourth doesn't seems ok but I want to match this also
for "foo_test_foo10.1.1.1.foo10.1.1.1.TEST-1.txt" I modified the expression as (\w\-{1,10}) and that works ... Is this correct way ?
trying to achieve the third format within the same format - as Nok
Output for now 1 ok 2 ok 3 ok 4 ok
Does this approach allows to use variable inside the regex format ?
Can I declare like my $var = foo10.1.1.1 and use this in regex format ?
Yes it does ... found answer for $var declaration I replaced ((?:\w+\.)+) as ((?:($var)+\.)+) ==> Is this correct too
Last thing I am not able to get
3 is not correct .... I want to filter this out
OR
foo_test_foo10.1.1.1.foo10.1.1.1.txt - How to match only this in a separate regex
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Regex lookahead, lookbehind
by choroba (Cardinal) on Feb 23, 2017 at 10:04 UTC | |
by rahulme81 (Sexton) on Feb 23, 2017 at 11:40 UTC | |
by choroba (Cardinal) on Feb 23, 2017 at 12:18 UTC | |
|
Re^3: Regex lookahead, lookbehind
by haukex (Archbishop) on Feb 23, 2017 at 10:33 UTC |