Double letters?

Get help with installation and running here.

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

Post Reply
DFH
Posts: 976
Joined: Sun Dec 09, 2007 2:49 am
Location: UK

Double letters?

Post by DFH »

Hi Simon,

Is there an easy method to search for double letters?

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
Regards,

Simon Carter, https://www.DataMystic.com
https://www.JadeDiabetes.com - Insulin dose calculator for Type 1 diabetes
https://www.DownloadPipe.com - 250,000 free software downloads
DFH
Posts: 976
Joined: Sun Dec 09, 2007 2:49 am
Location: UK

Re: Double letters?

Post by DFH »

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
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!
Regards,

Simon Carter, https://www.DataMystic.com
https://www.JadeDiabetes.com - Insulin dose calculator for Type 1 diabetes
https://www.DownloadPipe.com - 250,000 free software downloads
DFH
Posts: 976
Joined: Sun Dec 09, 2007 2:49 am
Location: UK

Re: Double letters?

Post by DFH »

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
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.
Regards,

Simon Carter, https://www.DataMystic.com
https://www.JadeDiabetes.com - Insulin dose calculator for Type 1 diabetes
https://www.DownloadPipe.com - 250,000 free software downloads
Post Reply