Welcome to the Bravenet Resource Center. Use these resources to help make your web pages more advanced and fun to use.
by Bernard Pehemail this article
Summary : In Linux and Unix, the syntax that is commonly used by many applications for specifying text patterns is known as regular expressions or in short form - regex.
In Linux and Unix, the syntax that is commonly used by many applications for specifying text patterns is known as regular expressions or in short form - regex. Regex is a very powerful technique to describe patterns and many programs use them to describe sequences of characters to be matched. Search programs such as 'grep' rely heavily on regex. Basically regex forms the core in the linux world. Many scripting languages such as perl, ruby, php...etc has build in regex functions as well. So you can see, learning regular expression is important because they are used alot in many places and probably more so in the future.
Regex can be scary at first but if you can get the basics, it is really not too hard to understand. In this article, we are going to look at how regex comes into the picture when writing php applications.
To do a quick summary so far, a regular expression is a sequence of literal characters, wildcards, modifiers and anchors.
Literal characters are letters, digits and special characters that match only themselves. Examples are abc, 123, ~@ and so on (some characters are reserved though).
Example '[a-z]' will match any alpha character that falls within the a to z range.