[Solved] Java: Regex: +Quantifier not working


[...] matches any character defined in the character class, so
[X{9,11}\\*{2,3}] actually means, a single character which is: X, or open brace, or 9, or comma, or 1, or 1 (yes you have it duplicated), or backslash, or asterisk….

So as your string have more than character in your string to-be-matched, such pattern will not match.

When you add a +, it means matching a string with 1 or more [ X or asterisk or….], so it match

I believe what you really want to do is using a group.

So the regex looks like (X{9,11}\*{2,3}])+

1

solved Java: Regex: +Quantifier not working