Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Golf: Fix de facto HTML comments

by Chady (Priest)
on Jul 19, 2004 at 07:47 UTC ( #375476=note: print w/replies, xml ) Need Help??


in reply to Golf: Fix de facto HTML comments

57

I believe this does it right.

It is important to note that you have the --> at the end, so the string inside the comment cannot end with - or else you will have --->

s/(?<=<!--)(.*?)-->/($_=$1);s|--|-¬|g;s|-$|¬|;"$_-->"/seg
use this to test it and see what it is matching:
s/(?<=<!--)(.*?)-->/($_=$1);s|--|-¬|g;s|-$|¬|;"[$_]-->"/seg

He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

Chady | http://chady.net/

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2023-12-06 17:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (31 votes). Check out past polls.

    Notices?