RE: [PHP-WIN] Return portion of a string
| From: | Scott Hurring | Date: | Thu, 16 May 2002 18:59:59 +0000 |
| Subject: | RE: [PHP-WIN] Return portion of a string | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-13827@lists.php.net to get a copy of this message | ||
...Or you could preg_match on the string.
$data = <a href="javascript:void(EXTERNALLINK('102'))">
preg_match('/EXTERNALLINK\(\'(\d+)\'\)/', $data, $matches);
var_dump($matches);
---
Scott Hurring
Systems Programmer
EAC Corporation
ScottH@eac.com
Voice: 201-462-2149
Fax: 201-288-1515
> -----Original Message-----
> From: R.S. Herhuth [mailto:ronherhuth@pop.mindspring.com]
> Sent: Wednesday, May 15, 2002 10:20 AM
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] Return portion of a string
>
>
>
> I have an instance where I have an article ($article) that may or may
> not contain:
>
> <a href="javascript:void(EXTERNALLINK('102'))">
>
> There might be many occurrances of this substring in exactly the same
> format but the id's will be unique with each occurance.
>
> Can someone please show me how to extract the id's (in this case the
> 102) of the above string into an array? I have been through the
> documentation on substrings and regular expressions but I'm just not
> getting it.
>
> Thanks,
> Ron
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>