Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
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 surveying the Monastery: (10)
As of 2015-07-28 04:55 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 (252 votes), past polls