Common uses of Regular expressions in php



Input validation
ð   Verifying input format, example an email address
ð   Parsing data from pre-defined variables.
ð   Searching for and replacing data(when required) in  a file or database.
ð   If PHP code space is being used to create user defined functions to validate or manipulate portions of a string, then these user-defined
functions could be fragmented and can be use regular expressions.

Types of regular expressions

ð   While the basics of regular expressions are pretty much the same across the board, there are different flavors.

ð   PHP supports two flavors of regular expressions.
ð   Perl compatible regular expressions (PCRE) and POSIX extended regular expressions have both been available since PHP3.

ð   PCRE is generally considered a bit faster, performance wise, than
POSIX.

ð   But the syntax of POSIX is easier to grasp.

ð   The basic concepts of regular expressions are the same for both types.



Common uses of Regular expressions in php Common uses of Regular expressions in php Reviewed by Unknown on 11:17:00 PM Rating: 5

No comments:

Powered by Blogger.