[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using grep to find duplicate characters in a word in bash
From: |
Chet Ramey |
Subject: |
Re: Using grep to find duplicate characters in a word in bash |
Date: |
Thu, 05 Nov 2009 08:12:09 -0500 |
User-agent: |
Thunderbird 2.0.0.23 (Macintosh/20090812) |
LHUHCD wrote:
> Is there a regular expression that can find duplicate characters in a word?
Sure. Match a character according to the specs you want, then match it
again using backreferencing. For instance, the following grep pattern
will match pairs of alphanumeric characters: '\([[:alnum:]]\)\1'
This doesn't really have anything to do with bash.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/