Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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]; }


Comment on Re: pattern sequence dispersed within text
Download Code

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 taking refuge in the Monastery: (9)
As of 2015-07-03 10:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (51 votes), past polls