$string =~ s/\</\<\;/g;
$string =~ s/\>/\>\;/g;
$string =~ s/[\"\'\}\{\)\(\+]//g; # Why???
$string =~ s/<!(?:--[\s\S]*?--\s*)?>\s*//g; # Never matches
$string =~ s/[\~\^]//g; # Why???
$string =~ s/~!/ ~!/g; # Why???
$string =~ s/<*(javascript)[^>]+>//gi; # Never matches
$string =~ s/(<[\s\/]*)(script\b[^>]*>)/$1x$2/gi; # Never matches
$string =~ s/<*(iframe)[^>]+>//gi; # Never matches
$string =~ s/<*(script)[^>]+>//gi; # Never matches
Those that never match don't match because < and > have been replaced. I didn't look at how useful they are by themselves.
You escape only two of the three HTML chars that differentiate text from HTML (<, > and &).
You convert text to HTML, but you remove all formatting (by not adding <pre> or some alternative). It may make for unreadable text.
\Y\o\u \a\l\s\o \h\a\v\e \w\a\a\a\a\a\y \t\o\o \m\a\n\y \"\\\"\!
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|