Regular Expressions: An Introduction
Published: January 12, 2004
User Rating: 8.9 (274 votes)
So taking the example above, we would say the syntax of regular expression is
identifier The pattern is always enclosed in a identifier. The most common identifier is the slash (/).
pattern Then there is the pattern, which you want to find and replace.
modifier And then there is the modifier. Modifier is like an option for the pattern, which define extra properties of the pattern matching.
For e.g. using the case-insensitive match modifier (i)
To read (understand) or write a regular expression pattern, you should ask the three simple question
- What characters to match ?
- How many characters to match ?
- And where to match ?
And therein lies the power and simplicity of the regular expression. Taking few examples