<?php
function qesc($s,$m) {
switch($m) {
case 0:
$s= str_replace("&" ,"&" ,$s);
return $s;
case 8:
$s= str_replace("&" ,"&" ,$s);
$s= str_replace("<" ,"<" ,$s);
$ ...
<title><?php echo qesc($s,0); ?></title>
<textarea><?php echo qesc($s,0); ?></textarea>
<div><?php echo qesc($s,8); ?></div>
<div style='font-family:courier new'><?ph ...
1. Characters used as operators should be escaped.
<JavaScript> $ ( ) * + . ? [ \ ] ^ { | }
2. Some control characters can be used with escapes.
<JavaScript> \0, [\b], \f, \n, \r, \t, \v
3. General Escapes.
<JavaScript>
\cX Where X is a lett ...
<JavaScript>
. (The decimal point) matches any single character except the newline character.
[xyz] A character set. Matches any one of the enclosed characters. You can specify a range of characters by using a hyphen.
[^xyz] A negated or complemen ...
<JavaScript>
* Specifies zero or more matches. Same as {0,}.
+ Specifies one or more matches. Same as {1,}.
? Specifies zero or one matches. Same as {0,1}.
{n} Specifies exactly n matches.
{n,} Specifies at least n matches.
{n,m} ...
<JavaScript>
^ Matches beginning of input. If the multiline flag is set to true, also matches immediately after a line break character.
$ Matches end of input. If the multiline flag is set to true, also matches immediately before a line break char ...
<JavaScript>
1. Creating a regular expression
literal format: aRegexp = /pattern/flags;
construction function: aRegexp = new RegExp("pattern"[, "flags"]);
2. Methods that use regular expressions
aRegexp.exec(aString);
aRegexp.test(aString);
aString.match ...
-