Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Regex to find URLs in <a> tags


g1smd - 1:04 pm on Jul 4, 2011 (gmt 0)


Handy tips:

Use "exactly"
(.*) ONLY when the very next thing is a $ "end" anchor, or when it is the ONLY thing in the pattern. Never use (.*) at the start or in the middle of a pattern.

Use "exactly"
.* if it is the ONLY thing in the RegEx pattern and the value is NOT being captured for re-use. Never use .* at the start or in the middle of a pattern.

The (.*?) pattern is less greedy but can still be problematical.

[edited by: g1smd at 1:21 pm (utc) on Jul 4, 2011]


Thread source:: http://www.webmasterworld.com/php/4334407.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com