Basic

Spending weekend with Regular expression.

Full regular expression conntain 2 types of characters. Special character that is Meta character (i.e *) ,  and the rest is literal (normal text characters).

This is the example of regular expression :

Pattern Name Example Description
^ caret ^cat match a line with cat at beginning
$ dollar dog$ match a line with dog at the end
[…] character class gr[ea]y match with grey or gray
[^…] Negated character class gr[ea]y [^1-6]match character that’s not in the range 1 through 6
dash H[1-6] same with H[123456]. it indicate range
(|) Parentheses with bar gr(a|e)y Output is same with gr[a|e]y
¥< backslash less-than ¥<cat¥> match the position at the start of the word
¥> backslash greater-than ¥<cat¥> match the position at the end of the word
? Question mark (means: optional) colou?r match color or colour. u part is always successful

Note :

  • Character class can only match a single character on the target
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: