smackdab has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I am reading lines from a file and getting confused on the quotes and regex stuff!!!!
I want 2a to work. I want to setup some $VALID regex rules up front and then compare them to lines in my file...
I am reading lines from a file and getting confused on the quotes and regex stuff!!!!
I want 2a to work. I want to setup some $VALID regex rules up front and then compare them to lines in my file...
$VALID1 = '[-a-zA-Z0-9_.*\s]'; $line1a = "[no\nluck]"; $line1b = "[no\nluck]"; $line2a = '[no\nluck]'; # FROM A read(<FILE>) $line2b = '[no\nluck]'; # FROM A read(<FILE>) print "luck1a\n" if $line1a =~ /\[\s*($VALID1+)\s*\]/m; print "luck1b\n" if $line1b =~ /\[\s*([a-z\s]+)\s*\]/m; print "luck2a\n" if $line2a =~ /\[\s*($VALID1+)\s*\]/; #DESIRED print "luck2b\n" if $line2b =~ /\[\s*([a-z\s]+)\s*\]/;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: character class problem
by Roger (Parson) on Oct 23, 2003 at 04:54 UTC | |
by smackdab (Pilgrim) on Oct 23, 2003 at 05:13 UTC | |
by Roger (Parson) on Oct 23, 2003 at 05:32 UTC |
Back to
Seekers of Perl Wisdom