Re: Help invoking a regexp
| From: | Nicklas af Ekenstam | Date: | Fri, 26 Jul 2002 13:19:26 +0000 |
| Subject: | Re: Help invoking a regexp | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-109716@lists.php.net to get a copy of this message | ||
On (2002-07-25 23:00), Analysis & Solutions wrote:
> The mailing list archive:
> http://groups.google.com/groups?group=php.general
>
> Good search terms:
> hyperlink "regular expression"
>
> Yields this article:
>
> http://groups.google.com/groups?q=hyperlink+%22regular+expression%22+group:php.general&hl=en&lr=&ie=UTF-8&safe=off&selm=3A248B2C.13ED233C%40analysisandsolutions.com&rnum=2‘jS”
> s*é^õPxö4B„
>
> Which has an excellent [shamelessly patting myself on the back] hyperlink
> regular expression for ereg*:
>
> "(http://|https://|ftp://|gopher://|news:|mailto:)
> ([[:alnum:]/!#$%&'()*+,.:;=?@~-]+)([[:alnum:]/!#$%&'()*+:;=?@~-])"
>
> Do note, if the last character of the URI is a "," or "." it assumes those
> are punctuation and leaves them off.
Thanks - that really is one sweet regexp.
However my problem is now that I can't figure out how to use it to suit my need.
This is what I want:
Apply above regexp to a string and have it extract all hyperlinks in that string
and return them in an array.
- Nicklas