Regular Expressions 101

Community Patterns

Todo

0

Regular Expression
ECMAScript (JavaScript)

/
(?<ch>[a-z])\1*
/
mg

Description

Regex to match consecutive identical characters. Then replace each match with <character><no of occurrence> Eg: "Hello" will yield "H1e1l2o1"

Submitted by Chief A - 3 years ago