Archive for the tag 'Regular'

SBDavid

Understanding Regular Expressions

Regular Expressions are a feature of UNIX. They describe a pattern to match, a sequence of
characters, not words, within a line of text.

Here is a quick summary of the special characters used in the grep tool and their meaning:

^ (Caret) = match expression at the start of a line, as in ^A.
$ (Question) = match expression at the end of a line, as in A$.
\ (Back Slash) = turn off the special meaning of the next character, as in \^.
[ ] (Brackets) = match any one of the enclosed characters, as in [aeiou]. Use Hyphen “-” for a range, as in [0-9].
[^ ] = match any one character except those enclosed in [ ], as in [^0-9].
. (Period) = match a single character of any value, except end of line.
* (Asterisk) = match zero or more of the preceding character or expression.
\{x,y\} = match x to y occurrences of the preceding.
\{x\} = match exactly x occurrences of the preceding.
\{x,\} = match x or more occurrences of the preceding.

PCRE - Perl Compatible Regular Expressions on Cpanel Servers.

The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.

The latest release of the PCRE library is 8.10. You can download it from its official home via anonymous FTP:

ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.10.tar.gz

tar xvzf pcre-8.10.tar.gz
cd pcre-8.10
./configure
make
make install

More at the man page - http://www.pcre.org/pcre.txt