How do we reduce repeating characters to a single character

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
gmb1994
Posts: 7
Joined: Wed Nov 30, 2005 7:19 am
Location: Dallas, Texas, USA

How do we reduce repeating characters to a single character

Post 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)
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Post by DataMystic Support »

Use the perl pattern

(.)\1+?

replace with

$1
Post Reply