Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 521
  • Last Modified:

Finding consecutively repeating characters

I'm trying to find a regular expression that will find consecutively repeating characters of 3 or more.

example:  If the string is B000B it should find 000 but if the string is B0000B it should find the first 3 0's from B000 and the last 3 0's from 000B.
0
NevSoFly
Asked:
NevSoFly
1 Solution
 
Marco GasiFreelancerCommented:
The pattern is

(.)\1{2}

since the first character is captured by \1 and the other 2 by {2}

Cheers
0
 
NevSoFlyAuthor Commented:
thanks for your reply.

The final pattern was actually (.)\1{2,}.  Thanks for the help.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now