RE: Regex Help for URL's

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Robert Samuel White [mailto:rsw@xxxxxxxxxxx]
> Sent: 16 May 2006 21:32
> To: php-general@xxxxxxxxxxxxx
> Subject: RE:  Regex Help for URL's
> 
> Don't be rude.  I've already don't all of that.  Nothing came up.  I've
> been
> programming for 20 years (since I was 11 years old) so I'm not a slacker
> when it comes to learning new things, however, I have always found regular
> expressions to be extremely difficult.  Someone here might have the answer
> I
> need, and if so, I'd appreciate a response.  If you don't know the answer,
> don't reply.  Simple enough, don't you think?
> -----Original Message-----
> From: Jochem Maas [mailto:jochem@xxxxxxxxxxxxx]
> Sent: Tuesday, May 16, 2006 4:28 PM
> To: Robert Samuel White
> Cc: php-general@xxxxxxxxxxxxx
> Subject: Re:  Regex Help for URL's
> 
> Robert Samuel White wrote:
> > Can someone help me modify the following code?
> >
> > It was designed to search for all instances of [LEVEL#]...[/LEVEL#]
> >
> > I need a preg_match_all that will search for all of instances of an URL.
> >
> > It should be sophisticated enough to find something as complicated as
> this:
> >
> > http(s)://x.y.z.domain.com/dir/dir/file.name.ext?query=1&query=2#anchor
> >
> > Any help would be greatly appreciated!
> 
> so your looking for a regular expression that is *totally* different
> from the regular expression you have... the two have nothing in common.
> 
> do you expect us to do the complete rewrite for you or do you want to
> learn abit about regexps yourself? (that probably sounds arrogant, so it
> might
> help to know even the most experienced people (a group I don't consider
> myself
> part of) here have [and do] get told to RTFM on occasion - no one is safe
> ;-)
> 
> I suggest using a search engine to start with and see what that turns
> up...
> somehow I can't believe that nobody has ever written a regexp that matches
> urls,
> for instance try reading this page in the manual (hint: look at the the
> user
> notes)
> 
> 	http://php.net/preg_match
> 
> come back when/if you get stuck.
> 
> >
> > preg_match_all('#\[LEVEL([0-9])\](.*)\[/LEVEL[0-9]]#Uim', $arcContent,
> > $tmpMatches);
> >
> > $arcContent = preg_replace('#\[LEVEL([0-9])\](.*)\[/LEVEL[0-9]]#Uim',
> > '###URL###', $arcContent);
> >
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> __________ NOD32 1.1541 (20060516) Information __________
> 
> This message was checked by NOD32 antivirus system.
> http://www.eset.com

Bearing in mind that none of the replies (particularly that of Jochem, one
of the posters that should be held in high regard) have been rude in any way
at all, I understand your plight with regex's

You might want to try the Regex Coach... It allows you to test your regex's
offline and can really help

http://www.weitz.de/regex-coach/

HTH

Dan

Personal note: Stop using Lookout... it sucks

-- 
http://chrome.me.uk

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux