|
Posted by Chuck Anderson on 08/10/06 19:34
ninja wrote:
> s a n j a y wrote:
>
>>> You wouldn't have truly mastered PHP if you hadn't mastered regexp.
>>>
>> I disagree. I have worked as a sr developer on a project written in php
>> and java. This project was and still is bigger than any projects I have
>> seen so far, that including all the open source projects. We used as
>> minimal of regex as possible.
>>
>
> Well, I guess that's precisely why it got so big in size :)
>
>
>> I personally hate regex. It is like a bad
>> programming practice and if you are a bit out of touch with it, its hell
>> to revisit the code and understand it.
>>
>> I wouldn't attach that great a significance to regex.
>>
>
> Seriously now, you're entitled to have an opinion, and I respect that.
> It is true that regexps can't (and shouldn't) help you much when you
> need to test integers or do something like that. However, regexps *are*
> the most powerfull paradigm available for handling string (as in, text)
> data.
>
But in the case that the OP brought up:
>
>> if ($attribute[0] != "id")
>>
>> The above is not 100% correct because it should also be looking for anything
>> ending with id. eg. bookid or authorid aswell as just id.
>>
>> Should I be looking at regular expressions?
Here's what the Php manual says:
"Tip: Do not use preg_match() if you only want to check if one string is
contained in another string. Use strpos() or strstr() instead as they
will be faster."
--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
*****************************
Navigation:
[Reply to this message]
|