Page 1 of 1

How do we reduce repeating characters to a single character

Posted: Wed Nov 30, 2005 8:20 am
by gmb1994
How do we reduce repeating, or multiple consecutive, characters to a single character, for example:

---- (multiple hyphens) => - (single hyphen)
aaaa (multiple letters) => a (single letter)

Posted: Mon Dec 05, 2005 8:57 am
by DataMystic Support
Use the perl pattern

(.)\1+?

replace with

$1