Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: RegEx Beginning of line or whitespace match

by Anonymous Monk
on Feb 12, 2005 at 15:04 UTC ( [id://430407]=note: print w/replies, xml ) Need Help??


in reply to RegEx Beginning of line or whitespace match

Hi, simple try this

use strict; use diagnostics; my $line = 'some_for($var)'; #don't match $line = ' for($var)'; #match $line = 'for($var)'; #match if($line =~ m#^(\s+)?for\(#si) { print "Match"; } else { print "Non-match"; }

Gubendran.L

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-19 09:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found