Double letters?

Get help with installation and running here.

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

Post Reply
dfhtextpipe
Posts: 988
Joined: Sun Dec 09, 2007 2:49 am
Location: UK

Double letters?

Post by dfhtextpipe »

Hi Simon,

Is there an easy method to search for double letters?

David
David
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Double letters?

Post by DataMystic Support »

Yes David,

Just use a perl pattern of

Code: Select all

([a-z])\1
dfhtextpipe
Posts: 988
Joined: Sun Dec 09, 2007 2:49 am
Location: UK

Re: Double letters?

Post by dfhtextpipe »

Did you understand my question?

I want a simple method to find double letters, not just two letters that may or may not be the same.

(aa|bb|cc|dd ... |xx|yy|zz) would do it, but there must be a shorter pattern, surely.

David
David
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Double letters?

Post by DataMystic Support »

Hi David,

[a-z]{2} will find two letters, what I wrote first does in fact work!
dfhtextpipe
Posts: 988
Joined: Sun Dec 09, 2007 2:49 am
Location: UK

Re: Double letters?

Post by dfhtextpipe »

How amazing!

I'm still struggling to understand how it does work.

Code: Select all

000084	aa
000018	ee
000406	ii
000021	oo
000009	ss
000009	uu
000223	vv
David
David
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Double letters?

Post by DataMystic Support »

\1, \2 etc in perl parlance refer to the previously matched text in captured sub-pattern 1, 2 etc.
Post Reply