Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Perl pattern matching question

by AnomalousMonk (Archbishop)
on May 06, 2015 at 18:05 UTC ( [id://1125878]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl pattern matching question
in thread Perl pattern matching question

Update: Note failure in the case of 'an log'.

c:\@Work\Perl\monks\MadhAric>perl -wMstrict -le "my $string = 'A log and a axe, an log and an axe'; print qq{'$string'}; ;; $string =~ s/\b([Aa])(\s+[aeiou])/$1n$2/g; print qq{'$string'}; " 'A log and a axe, an log and an axe' 'A log and an axe, an log and an axe'

Even ignoring the subtleties of pronunciation you pointed out, the OPed problem statement is tricky. Some cases need 'n' deleted, so I don't see how it can be done (in a single regex) without decision-making in the replacement clause, i.e., use of the  /e modifier or equivalent trick.


Give a man a fish:  <%-(-(-(-<

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-04-26 01:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found