[Israel.pm] another regexp Q

Yuval Yaari yuval at windax.com
Wed Oct 17 00:17:05 PDT 2007


Ernst, Yehuda wrote:
> Hello!
>
> I have an  array like this:
>
> "aaadkjfh"
> "abcde"
> "dskkk"
>
> i want to take out the elements that have 3 same letters together.
>
> so i will be left with "abcde"
>   
Gaal and Dov already pointed `grep` out in their replies to your 
previous question, haven't they?
All I have left to say is: `perldoc -f grep` (or re-read their 
respectable replies, or both :)).

As for matching the same character 3 times, something like m/(\w)\1{2}/ 
should do the trick, I guess.

HTH,

  ~Y



More information about the Perl mailing list