ByulTaeng
ByulTaeng

Reputation: 1269

Regex: How to match a string that contains repeated pattern?

Is there a regex pattern that will match a string that contains repeated pattern, e.g.:

"a"|"b","c"|"d",...,"y"|"z"

Do you have any idea?

Upvotes: 3

Views: 5646

Answers (2)

Eric Wendelin
Eric Wendelin

Reputation: 44349

Just a note that to truly look for a repeated pattern, you can use grouping like so:

<(htmltag>).*\1

where \1 refers to the matched string in the 1st group repeated. Make sense?

Upvotes: 2

Gumbo
Gumbo

Reputation: 655239

Maybe you are looking for something like this:

^"."\|"."(,"."\|".")*$

This will match a comma-separated list of sequences of form "α"|"β" where α and β can be any character.

Upvotes: 4

Related Questions