Repeater clarification


For a very long time, I've had a question about regular expression repeaters. What is the difference between

(or between [xyz?] and [xyz]? - or of course same question using * )

Is one wrong and the other correct, or do they have their own valid meaning?


Both are correct regular expressions, but only the latter treats the + character as quantifier.

[xyz+] matches a single character present in the given list (including the + character).
[xyz]+ matches between one and unlimited occurrences of the characters present in the given list.


An other way to get a detailled explanation:
Enter your regex in one of the online regex tester like

There you can enter some text and see immediately how your regular expression would match (or not) a part of your text.


Hi, you can visit this website to learn regular expression syntax :
And visit this website to test regular expression: