Forum Moderators: coopster
$a = array('~','1','2','3','4','5','6','7','8','9','0', '-','=','`','!','@','#','$','%','^','&','*','(',')', '_','+','Q','W','E','R','T','Y','U','I','O','P','{','}', '¦','A','S','D','F','G','H','J','K','L','\'','Z','X','C', 'V','B','N','M','[',']','\\',';','\'','q','w','e','r','t', 'y','u','i','o','p','a','s','d','f','g','h','j','k','l', 'z','x','c','v','b','n','m','<','>',',','.','/','?');
thanks
[edited by: jatar_k at 8:30 pm (utc) on July 6, 2004]
[edit reason] fixed sidescroll [/edit]
The special regular expression characters are: . \\ + *? [ ^ ] $ ( ) { } =! < > ¦ :
$a = array('~' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , '0' , '-' , '=' , '`' , '!' , '@' , '#' , '\$' , '%' , '^' , '&' , '\*' , '(' , ')' , '_' , '\+' , 'Q' , 'W' , 'E' , 'R' , 'T' , 'Y' , 'U' , 'I' , 'O' , 'P' , '{' , '}' , '¦' , 'A' , 'S' , 'D' , 'F' , 'G' , 'H' , 'J' , 'K' , 'L' , '\'' , 'Z' , 'X' , 'C' , 'V' , 'B' , 'N' , 'M' , '[' , ']' , '\\' , ';' , '\'' , 'q' , 'w' , 'e' , 'r' , 't' , 'y' , 'u' , 'i' , 'o' , 'p' , 'a' , 's' , 'd' , 'f' , 'g' , 'h' , 'j' , 'k' , 'l' , 'z' , 'x' , 'c' , 'v' , 'b' , 'n' , 'm' , '<' , '>' , ',' , '\.' , '/' , '\?');
string. When you set a value as a string [php.net], the only character you'll need to escape will be the backslash itself since it will occur before the single quote which is at the end of the string -- '\\'. To get the single quote character into your array, just use double quotes around that particular entry -- "'"
For what it's worth, Perl compatible regex functions are usually faster than the POSIX regex functions. POSIX regex's do indeed include braces and brackets as special characters, so they would need to be escaped as well.