3

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?

nhahtdh
  • 54,546
  • 15
  • 119
  • 154
ByulTaeng
  • 1,269
  • 1
  • 21
  • 39

2 Answers2

4

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.

Gumbo
  • 620,600
  • 104
  • 758
  • 828
2

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?

Eric Wendelin
  • 41,234
  • 8
  • 61
  • 88