The following is from a tutorial at this address: http://www.regular-expressions.info/
Think of regular expressions as wild cards on steroids.
This part can be found under: http://www.regular-expressions.info/quickstart.html
A regular expression, or regex for short, is a patter describing a certain amount of text.
Eleven character with special meanings:
- [ - the opening square bracket
- \ - the backslash
- ^ - the caret
- $ - the dollar sign
- . - the period or dot
- | - the vertical bar or pipe symbol
- ? - the question mark
- * - the asterisk or star
- + - the plus sign
- ( - the opening round bracket
- ) - the closing round bracket
- ] - the closing square bracket should be also
Use the dot sparingly. Often the character class or negated character class is faster and more precise.
The word boundaries for a numeric expression might not be what I might think.
Alternation: cat|dog
Placing a question mark after a quantifier will make it lazy.
No comments:
Post a Comment