Happen to come across Regex lookahead, lookbehind and atomic groups in perl, though not very expert to use in first try.
Got a thought - If I can match a string name within a single regular expression with this concept
So I can avoid using multiple match patterns to deal with something required on this matches within my program
My search patterns looks like as below :
foo_bar_foo10.1.1.1.TEST.txt foo_test_foo10.1.1.1.foo10.1.1.1.TEST_test.txt
"foo"
1. followed by "underscore"
2. followed by "bar|test" (bar or test)
3. followed by "underscore"
4. followed by alhpnum string with dot at end (like foo10.1.1.1)
5. followed by one or zero occurences of same alhpnum string (like foo10.1.1.1)
6. followed by dot
7. followed by 1-10 characters, containing at least one digit and one letter and underscore (e.g. TEST_test, TEST_test2, TEST1_test2)
8. ends with .txt
Thanks in advance
In reply to Regex lookahead, lookbehind by rahulme81
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |