View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Adrian Caspersz Adrian Caspersz is offline
external usenet poster
 
Posts: 19
Default Regular expression problem

On 24/06/2020 10:47, RG III wrote:
Using only regular expressions, how do you match the
pattern of the same digit that occurs three times in
a string, separated by one character?

Examples:

0a0a0 ' 0 occurs three times separated by "a"
9x9x9 ' 9 occurs three times separated by "x"
1:1:1 ' 9 occurs three times separated by ":"

Robert


using a global match and a capturing group containing alternation

(\d[a|x|:]?){3}

Try it on regex101.com

--
Adrian C