Wednesday, January 14, 2009

RegExp Basics

Let’s start with some very simple stuff. A regular expression can just contain the exact letters you want to match.

text

This text is all about the complicated stuff.

The regular expression /text/ will match the string. This is very simple you might think. So lets move on. With regular expressions you can also find multiple matches within a string.

te

This text is all about the complicated stuff.

/te/ will match two times.

t

This text is all about the complicated stuff.

/t/ will even match six times. The capitalized T will not match.

come

will not match the string but comp will match.


No comments:

Post a Comment