Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Regx: match without regarding space and case

by Sidhekin (Priest)
on Sep 13, 2007 at 06:06 UTC ( #638737=note: print w/ replies, xml ) Need Help??


in reply to Regx: match without regarding space and case

This works for me:

my $x="My name is VC"; my $y="myname"; my $r = do { local $" = ' *'; my @r = split //, $y; qr/@r/i }; if ($x =~ /($r)/) { printf "Matched from %d to %d: '%s'\n", $-[0], $+[0], $1; }

Prints:

Matched from 0 to 7: 'My name'

print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!


Comment on Re: Regx: match without regarding space and case
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2014-07-12 00:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (236 votes), past polls