in reply to Deriving File name convention with Look-ahead and look-behind assertion
Your code sample doesn't make much sense. With the \s after the IP address (not present in the input string) the expression inside the look-behind assertion will always fail. But, with a litteral "failed" the regex as a whole won't ever match. So this can't be how you got that output. See How do I post a question effectively?
Anyway, what about /(\w*IP(\d+\.){4}){2}(.*\.)?SKIP/ ? You just have to check if $3 is defined or not (or simple remove the ?) to see if you are in a simple or full match
Edit: added \w* in front of IP to match the examples in the description of the problem (not just the examples in the __DATA__ section).
|
|---|