. Updated Daily. Editions SDA India   SDA Indonesia
BUSINESS ENTERPRISE SOLUTIONS ARCHITECTURE INFORMATION SECURITY WIRELESS & MOBILITY DATA & STORAGE DEVELOPMENT HARDWARE













News

Tuesday, 5 June 2007

Regular Expressions in PHP

 

 

Mitchell Harper in PHPBuilder.com gives you a new tutorial on regular Expressions to manipulate strings in PHP.

For the uninitiated, a regular expression is a specially formatted pattern that can be used to find instances of one string in another. Several programming languages including Visual Basic, Perl, JavaScript and PHP support regular expressions, and the article also tries to implement some basic regular expression functionality into PHP pages.

He lists six functions that work with regular expressions in PHP. They all take a regular expression string as their first argument, and are shown below:

  • ereg: The most common regular expression function, ereg allows us to search a string for matches of a regular expression
  • ereg_replace: Allows us to search a string for a regular expression and replace any occurrence of that expression with a new string
  • eregi: Performs exactly the same matching as ereg, but is case insensitive
  • eregi_replace: Performs exactly the same search-replace functionality as ereg_replace, but is case insensitive
  • split: Allows us to search a string for a regular expression and returns the matches as an array of strings
  • spliti: Case insensitive version of the split function

 

Read the Post

 
 
print save email comment

print

save

email

comment

 
 

Search SDA Asia

Free eNewsletter

SDA Asia Magazine Free Download
 
 
 
Copyright @ 2009 SDA Asia Magazine - All Right Reserved Privacy Policy | Terms of Use