Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old June 24th 20, 10:47 AM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: May 2019
Posts: 65
Default Regular expression problem

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

  #2   Report Post  
Old June 24th 20, 05:37 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Sep 2016
Posts: 16
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tricky regular expression RG III Excel Programming 15 May 21st 19 10:55 AM
Can someone help me with this regular expression? [email protected] Excel Discussion (Misc queries) 3 March 10th 09 08:36 PM
Help with regular expression PO Excel Programming 3 May 2nd 07 01:39 PM
Regular Expression sl Excel Discussion (Misc queries) 2 January 24th 07 12:57 AM
Regular expression searching problem LarryLev Excel Programming 0 September 15th 05 07:44 PM


All times are GMT +1. The time now is 02:20 PM.

Powered by vBulletin® Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright 2004-2020 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"

 

Copyright © 2017