Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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 pondering the Monastery: (8)
As of 2014-12-21 09:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (104 votes), past polls