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


In reply to Re^2: Regex lookahead, lookbehind by rahulme81
in thread Regex lookahead, lookbehind by rahulme81

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.