To nie php, tylko składnia regularna (regex)
Cytat
Regular Expressions
Patterns ("wildcards") are matched against a string
Special characters (see [http://www.regular-expressions.info/reference.html] for reference):
. (full stop) - match any character
\* (asterisk) - match zero or more of the previous symbol
\+ (plus) - match one or more of the previous symbol
? (question) - match zero or one of the previous symbol
\\? (backslash-something) - match special characters
^ (caret) - match the start of a string
$ (dollar) - match the end of a string
[set] - match any one of the symbols inside the square braces.
[^set] - match any symbol that is NOT inside the square braces.
(pattern) - grouping, remember what the pattern matched as a special variable
{n,m} - from n to m times matching the previous character (m could be omitted to mean >=n times)
(?!expression) - match anything BUT expression at the current position. Example: "^(/(?!(favicon.ico$|js/|images/)).*)" => "/fgci/$1"
Normal alphanumeric characters are treated as normal
//^^ dla lighttpd
Cytat
Char. Definition
\ Use before any of the following characters to escape or null the meaning or it. \* \. \$ \+ \[ \]
^ Start matching at this point
$ End point of the match
. Any character
[] Starts a class
| Starts alternative match this|that would mean match this or that
() starts a back reference point
? match 0 or 1 time Quantifier
+ match atleast 1 or more times Quantifier
* match 0 to infinite times Quantifier
{} match minimum to maximum Quantifier {0,3} match up to 3 times
Class Definitions []
Char. Definition
^ Negates the class. [^A-Z]+ means don't match any uppercases
\ Use before any of the following characters to escape or null the meaning or it. [\+]+
- Range for matching [0-9]+ [a-zA-Z]+
//^^ dla apache
No i teraz sobie pozamieniaj na odpowiadające znaki
na przykład:
url.rewrite-once = ( "^bany$" => " index.php?app=custompages&do=show&pageId=1>" )