Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Lookahead/Lookbehind Regular Expression...

by wind (Priest)
on Dec 19, 2013 at 17:35 UTC ( #1067841=note: print w/replies, xml ) Need Help??


in reply to Lookahead/Lookbehind Regular Expression...

It sounds like you're just wanting to remove any periods that follow just one word character. I'm sure there might be a rare exception to this, but the following would accomplish that basic feat:
use strict; use warnings; my $str = "a history of u.s. coast guard aviation. M.C. Esher"; $str =~ s/(?<=\W\w)\.//g; print $str, "\n";
I'd also be tempted to force capitalization on those abbreviations, but that might not be what you're after:
# Remove periods and capitalize, so we have US instead of us. $str =~ s/(?<=\W)(\w)\./\U$1/g;
- Miller

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1067841]
help
Chatterbox?
[RonW]: (I use Windows as little as possible)
[LanX]: RonW: yes I think something like inline::Rperl would be great, but Will is AFAIK not interested to go that way
[james28909]: well now i am using a for /f delims= %i IN(yt-dl) do set var=%i & ffmpeg -i "%var%" -a:c mp3 output.mp3 & set var=
[james28909]: just to get around not being able to do yt-dl | ffmpeg
[james28909]: learning is fun ISNT IT?!?!!??
[RonW]: that seems very weird to me
choroba submitted 2 talks to (YA|T)PC::EU
[RonW]: Choroba: I hope they get accepted

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (11)
As of 2017-05-22 21:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?