the r(ege)+x
expression will match the letter r
followed by one or more sets of the string of letters ege
followed by the letter x
Possible matches would be “regex”, “regeegex”, “regeegeegex”, and so on.
The expression r[ege]+x
will match the letter r
followed by one or more of any of the letters in the square brackets, followed by the letter x
.
Possible matches would be “rex”, “rgx”, “reeex”, “rgggx”, “regegeggggx”, etc. In the square bracketed expression, the second “e” is redundant, by the way.
You can test expressions using a site like http://regex101.com or similar.