Jump to content

preg_match vs eregi


redarrow

Recommended Posts

I just was learning preg_match from the manual and i see that theres littile changes to eregi so what can preg_match do what eregi can not.



<?
$match="my little home";

if(preg_match("/little/",$match)) {

echo "matched";

}else{

echo " no match";

}


?>

<?
$match="my little home";

if(eregi("little",$match)) {

echo "matched";

}else{

echo " no match";

}


?>
Link to comment
Share on other sites

PCRE:
[list]
[*]are (typically) faster;
[*]are binary safe;
[*]allow greediness modifications;
[*]have better shortcuts (in my opinion);
[*]are more advanced (lookarounds, recursion, subpatterns);
[*]are decimal, octal, hex, UTF-8, and Unicode friendly;
[*]have more switches, especially a documentation-friendly one (x).
[/list]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.