Archive for June, 2007

I wonder today when I see that I
have forgotten that vary simple things of regular expression.
I was good in regular expression at university time. Time goes
no practices and brain betrayed and forgotten. Strange!!

I searched to remember again how
regular expression can be written; at least Google did not betrayed got a nice site
where they told very basic of Regular Expression. Now I can remember everything.
This is a nice site to know very basic of regular expression

> Just this table is enough I think

^ Start of a string.
$ End of a string.
. Any character (except n newline)
{…} Explicit quantifier notation.
[…] Explicit set of characters to match.
(…) Logical grouping of part of an expression.
* 0 or more of previous expression.
+ 1 or more of previous expression.
? 0 or 1 of previous expression; also forces minimal matching when an expression might
match several strings within a search string.
Preceding one of the above, it makes it a literal instead of a special character.
Preceding a special matching character, see below.
w matches any word character, equivalent to [a-zA-Z0-9]
W Matches any non word character, equivalent to [^a-zA-Z0-9].
s matches any white space character, equivalent to [fnrv]
S matches any non-white space characters, equivalent to [^fnrv]
d matches any decimal digits, equivalent to [0-9]
D matches any non-digit characters, equivalent to [^0-9]
a Matches a bell (alarm) u0007.
b Matches a backspace u0008 if in a [] character class; otherwise, see the note following
this table.
t Matches a tab u0009.
r Matches a carriage return u000D.
v Matches a vertical tab u000B.
f Matches a form feed u000C.
n Matches a new line u000A.
e Matches an escape u001B
$number Substitutes the last substring matched by group number (decimal).
${name} Substitutes the last substring matched by a (? ) group.
$$ Substitutes a single “$” literal.
$& Substitutes a copy of the entire match itself.
$` Substitutes all the text of the input string before the match.
$’ Substitutes all the text of the input string after the match.
$+ Substitutes the last group captured.
$_ Substitutes the entire input string.
(?(expression)yes|no) Matches yes part if expression matches and no part will be omitted.

Read Full Post »