below two examples are expected behaviors. no problems
both "xxx2", "xxx@" match with "xxx." pattern.
$ echo abc1xxx2abc3abc4@111 | sed -rn 's/((abc.|xxx.){3}).*/\1/p'
abc1xxx2abc3
$ echo abc1xxx@abc3abc4@111 | sed -rn 's/((abc.|xxx.){3}).*/\1/p'
abc1xxx@abc3
also below two examples are expected behaviors.
both "xxx@", "xxxy" match with "xxx." pattern
but right next "@" char is not match for pattern so no output
$ echo abc1xxx@@abc3abc4@111 | sed -rn 's/((abc.|xxx.){3}).*/\1/p'
no output
$ echo abc1xxxy@abc3abc4@111 | sed -rn 's/((abc.|xxx.){3}).*/\1/p'
no output
but if i changed the "y" in the above example to "x" then
suddenly pattern is matched even though next char is "@"
I can't understand this behavior
$ echo abc1xxxx@abc3abc4@111 | sed -rn 's/((abc.|xxx.){3}).*/\1/p'
abc1xxxx@abc3abc4