Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Regular Expression Question

by kelan (Deacon)
on Apr 03, 2003 at 18:18 UTC ( #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? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2022-11-29 20:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?