Re: Find repeating substring
- From: Mirco Wahab <peace.is.our.profession@xxxxxx>
- Date: Tue, 20 Jun 2006 16:28:14 +0200
Thus spoke Mike (on 2006-06-20 16:19):
Hmm. This seems very close. It still picks up the code (37.33/2) that
is not repeated, but let me play with this a bit to see if I can
exclude that.
It doesn't here, consider:
my $text = <<END_OF_TEXT;
HEART (CONDUCTION DEFECT) 37.33/2 HEART (CONDUCTION DEFECT) WITH
CATHETER 37.34/2
END_OF_TEXT
my $rep = qr{ ^(.+)(?=\s*).*?\1 }msx;
my ($repeated) = $text=~/$rep/;
print $repeated;
prints: HEART (CONDUCTION DEFECT)
(BTW: I made the final .* non-greedy)
Regards
Mirco
.
- References:
- Find repeating substring
- From: Mike
- Re: Find repeating substring
- From: thundergnat
- Re: Find repeating substring
- From: Mike
- Find repeating substring
- Prev by Date: Re: How to write matching pattern for multi-line HTML tag ?
- Next by Date: testing hard-ware modules using perl script
- Previous by thread: Re: Find repeating substring
- Next by thread: Re: Find repeating substring
- Index(es):
Relevant Pages
|
Loading