webproger > cheat sheets > study
 
htmlspecialchars()
219 SHARED
 
JavaScript RegExp Reference
1497 SHARED
 
qesc()
<?php
function qesc($s,$m) {
    switch($m) {
        case 0:
            $s= str_replace("&" ,"&amp;" ,$s);
            return $s;
        case 8:
            $s= str_replace("&" ,"&amp;" ,$s);
            $s= str_replace("<" ,"&lt;"  ,$s);
            $ ...
8962 SHARED
 
qesc()
                              <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 ...
85 SHARED
 
Songs in Easy English
 
regular expression
4875 SHARED
 
regular expression 1 character escapes
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 ...
2393 SHARED
 
regular expression 2 character classes
<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 ...
4870 SHARED
 
regular expression 3 quantifiers
<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}  ...
4872 SHARED
 
regular expression 4 assertions
<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 ...
4873 SHARED
 
regular expression 5 usage
<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 ...
4874 SHARED
 
string conversion
83 SHARED
 
Unicode
62 SHARED

-