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
  • 55,989
  • 15
  • 126
  • 162
ByulTaeng
  • 1,269
  • 1
  • 21
  • 40

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
  • 643,351
  • 109
  • 780
  • 844
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
  • 43,147
  • 9
  • 68
  • 92