Recent changes Random page
GAMING
Technology
 
Gaming
Entertainment
Science Fiction
Biggest wikis
Hobbies
Music
See more...

Regular expressions

From Programmer's Wiki

Jump to: navigation, search
 

Regular expressions are string expressions which are used to identify matching patterns in other strings. Many languages and environments implement regular expressions, often with small differences. Regular expressions first gained large-scale use on unix systems in conjunction with tools such as grep, awk, and sed.

[edit] Simple Examples

Example 1. literal (no special characters used)

hello

Matches the string "hello" only.

Example 2. any character. the "." character matches any character except newline (\n).

an.

Matches "an!", "and"

Example 3. zero-or-more characters. the "*" character matches any string zero or more of the character immediately preceding it.

hel*

Matches "he", "hel", "hellll"

[edit] Concepts

Rate this article:
Share this article: