Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 01-12-2008, 12:27 AM preg vs ereg
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
I'm curious: I see a lot of posts here which use ereg instead of preg. preg seems to be more versatile to me, so I'm wondering why one would use ereg instead. Am I missing something?
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
 
Register now for full access!
Old 01-12-2008, 02:26 AM Re: preg vs ereg
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
I'm not sure really, I don't think it really matters. But I tend to use ereg if I'm just trying to test the value of something for a simple true or false eval, but use preg for matching in all other instances.
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 01-24-2008, 07:50 AM Re: preg vs ereg
carloncho's Avatar
Skilled Talker

Posts: 80
Name: Carlos
Trades: 0
preg is better for complex uses, and is more standar regex use, but in some servers theres is no the library to use with php. In php5 is installed, but i not sure
I use preg when i can.
__________________
-----------------------

Please login or register to view this content. Registration is FREE
carloncho is offline
Reply With Quote
View Public Profile Visit carloncho's homepage!
 
Old 01-24-2008, 12:34 PM Re: preg vs ereg
phpknowhow's Avatar
Skilled Talker

Posts: 83
Name: Colin
Location: USA
Trades: 0
Preg functions are faster and better for complex patterns. Its also Perl compatible, if you are familiar with that language. I have made it a habit to always use preg functions. The syntax is not very hard to learn when compared to ereg, so I don't find any reason why to use ereg, unless your just starting out with regular expressions. Even so, its probably better to just forget learning ereg in the first place.

Preg also has the function preg_match_all() which is extremely useful, and has no counterpart in the ereg function group.
__________________

Please login or register to view this content. Registration is FREE
| Freelance PHP solutions for small to midsized projects |
Please login or register to view this content. Registration is FREE
phpknowhow is offline
Reply With Quote
View Public Profile Visit phpknowhow's homepage!
 
Reply     « Reply to preg vs ereg
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.41933 seconds with 12 queries