Sure thing! Grouping and references are your friends:
(.)\1+
Will match 2 or more occurences of the same character. For word constituent characters only, use \w
instead of .
, i.e.:
(\w)\1+
More Related Contents:
- string pattern matching using perl regex [closed]
- Awk – replace coumn 2 in table 1 from coumn 2 in table 2 based on matching data in column 1 (common between tables)
- Match whitespace but not newlines
- The recognizing power of “modern” regexes
- Should I use \d or [0-9] to match digits in a Perl regex?
- Escaping a forward slash in a regular expression
- How can I use a variable in the replacement side of the Perl substitution operator?
- When is \G useful application in a regex?
- Using alternation or character class for single character matching?
- Verbs that act after backtracking and failure
- How to extract string following a pattern with grep, regex or perl [duplicate]
- regex to match word boundary beginning with special characters
- Regex to match any character including new lines
- Does the ‘o’ modifier for Perl regular expressions still provide any benefit?
- How do I handle special characters in a Perl regex?
- How can I find the location of a regex match in Perl?
- How can I exclude some characters from a class?
- Can I use Perl regular expressions to match balanced text?
- What is the difference between \1 and $1 in a Perl regex?
- How do I perform a Perl substitution on a string while keeping the original?
- How can I match a quote-delimited string with a regex?
- How can I use a variable for a regex pattern without interpreting meta characters?
- How can I parse quoted CSV in Perl with a regex?
- how to match a number which is less than or equal to 100?
- Is There a Way to Match Any Unicode Alphabetic Character?
- How to escape dollar sign ($) in a string using perl regex
- Can I substitute multiple items in a single regular expression in VIM or Perl?
- How to use different separators (/ , |) in a regular expression
- Counting number of occurrences of a string inside another (Perl)
- How to replace a string in an existing file in Perl