Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: One-liner to fix LaTeX quotation marks

by LanX (Canon)
on Oct 14, 2012 at 19:40 UTC ( #998969=note: print w/ replies, xml ) Need Help??


in reply to One-liner to fix LaTeX quotation marks

what you are looking for is called "negative look ahead"

see http://perldoc.perl.org/perlretut.html#Looking-ahead-and-looking-behind

DB<100> $txt=q( This is "an example", but "`this not"'. ) => " This is \"an example\", but \"`this not\"'. " DB<101> $txt =~ s/"(?![`'])/'/g => 2 DB<102> $txt => " This is 'an example', but \"`this not\"'. "

but you might get bitten by shell escaping if you try a one-liner

Cheers Rolf


Comment on Re: One-liner to fix LaTeX quotation marks
Download Code
Re^2: One-liner to fix LaTeX quotation marks
by tim_the_monk (Initiate) on Oct 14, 2012 at 19:56 UTC
    Thanks a lot for the info and link.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2014-10-02 17:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (67 votes), past polls