Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Regexp to match regardless of whitespace

by JavaFan (Canon)
on May 03, 2012 at 17:05 UTC ( #968778=note: print w/ replies, xml ) Need Help??

in reply to Regexp to match regardless of whitespace

There's no modifier that let you skip anything.

If you're just grepping for string literals, it's trivial to change it to allow for spaces:

my $pattern = join '\s*', split //, "whatever"; while (<>) { print if /$pattern/; }
Otherwise, I'd do as suggested: remove the whitespace in the line, than apply the pattern.

Comment on Re: Regexp to match regardless of whitespace
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2015-11-28 16:15 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (743 votes), past polls