Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: pattern sequence dispersed within text

by remiah (Hermit)
on Oct 01, 2012 at 14:42 UTC ( #996670=note: print w/ replies, xml ) Need Help??


in reply to pattern sequence dispersed within text

hello. How about like this ?

use warnings; use strict; my $words = 'xxxhexxxxxxxx xle xxnxle nxxx xxnxxx xnxxhexx nxxxxx xlex +xxxxx nxnx xxxx'; my $string='helen'; print "string=$string\n"; print "words=$words\n"; my @other_stuff = split (/\s+/, $words); my @pairs = $string =~ /..?/sg; my $target=$pairs[0]; my $idx=0; while ($words =~ /(\b\w*?$target\w*?\b)/g ){ print "target=$target,matched=$1\n"; $idx++; $idx=0 if $idx > $#pairs; $target = $pairs[$idx]; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://996670]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2016-06-27 09:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (337 votes). Check out past polls.