|Problems? Is your data what you think it is?|
Re^3: Anagrams & Letter Banksby Cristoforo (Curate)
|on Oct 27, 2017 at 20:41 UTC||Need Help??|
The parentheses capture one letter and look for a repeat, \1. He greps for a string which doesn't cause the regular expression to succed, (! /.....
I should have been more thorough in my reply. When there is a parentheses around an expression, in this case '.', \1 refers to that captured value. If an 'a' was captured, then \1 would be a. If a 'd' was captured, then for \1 to match, it would need to find a 'd' somewhere further in the string.
Perl will try to make the match succeed, so it will progress matching each letter until it finds a match. If it does, then the the regexp will succeed. Else, it will fail.
If it fails then the grep succeeds!
There would be a \2 if there were 2 sets of capturing parentheses. \1 would be what was captured in the first parens and \2 would be what was captured in the second set of parens. In this problem there is only one set of parens so only \1 would be involved.