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

Re: Regular Expression Question

by kelan (Deacon)
on Apr 03, 2003 at 18:18 UTC ( [id://247839]=note: print w/replies, xml ) Need Help??


in reply to Regular Expression Question

You're pretty close, but you aren't doing any substitution. You want something more like this:

$pat = "cccv"; $pat =~ s/c/[^aeiou]/g; $pat =~ s/v/[aeiou]/g; if ($word =~ /($pat)/) { $yep++; }
You need to actually substitute the 'c's and 'v's for the character classes before trying to do the matching.

kelan


Perl6 Grammar Student

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (1)
As of 2024-04-18 23:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found