Hi Giovanni,
"(?=(\\d+))\\w+\\1"
(?=(\\d+)) - it will match and construct an Number set
\\w+ - Matches one or more characters
\\1 - Exactly matches the first Group, means (?=(\\d+))
When we pass a 123x12 - first group matches three number sets, they are 123, 23 and 3
So the same set should appear after the character.
We have 12 after the character x, so 12 is not matched with any of the number set returned by group 1.
this is the reason why it is not matched.
We'll take the second (+ve) example:
When we pass a 456x56 - first group matches three number sets, they are 456, 56 and 6
We have 56 after the character x, so it is matched.
Hope what i explained is understandable.
Thanks,
Rajasekar.