Regex – Adding Comments

If you have worked through the entire tutorial, I guess you will agree that regular expressions can quickly become rather cryptic. Therefore, many modern regex flavors allow you to insert comments into regexes.

Regex – Free Spacing

The PHP, JGsoft engine, .NET, Java, Perl, PCRE, Python, Ruby and XPath support a variant of the regular expression syntax called free-spacing mode. We can turn on this mode with the (?x) mode modifier or by turning on the corresponding option in the application.

Regex – Matching Modes

Most of the regular expression engines generally support four types of matching modes Single line mode, case insensitive, multi line mode, free spacing modes.

Regex – Repetition Using Various Quantifiers

In Regular Expression the asterisk or star (*) tells the engine to match the preceding token zero or more times. The plus (+) tells the engine to match the preceding token once or more.

Regex – Optional Item

The question mark makes the preceding token in the regular expression optional. E.g.: colou?r matches both colour and color.

Regex – Alternation

As i already explain how to use the character class to match a single character out of given bunch of characters. Alternation is similar. We can you use alternation to match a single pattern in a document out of given bunch of patterns.

Regex – Word Boundries in Regular Expression

The metacharacter \b is an anchor like the dollar and caret sign. It matches at a position that is called a word boundires. Zero length match.

Regex – Start and End of String or Line Anchors

Anchors are a special type or different breed. They do not match any character at all. Instead, they match a position before, after or between characters.

Regex – Dot Matches (Almost) Any Character

In regular expression , the dot or periodic is one the most commonly used metacharacter. Unfortunately, it is also the most commonly misused metacharacter.

Regex – Character Classes or Character Sets

With the help of a “character class”, also known as “character set”, we can tell the regex engine to match one more out of multiple characters

About Us

webtechtuts is a site by web developers aimed at web developers and designers offering articles on technologies, skills and techniques to improve how you design and build websites. We cover HTML, CSS, Javascript, PHP, Photoshop, MySql, Oracle, and TeraData.