Re: Searchingfor text within a string
| From: | Patrick Brown | Date: | Tue, 29 Aug 2000 15:00:33 +0000 |
| Subject: | Re: Searchingfor text within a string | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-14147@lists.php.net to get a copy of this message | ||
Could I have a problem with my ereg command? I've tried several methods if
getting the data out of the string and get nothing. Maybe there's a library
update or a setting in by PHP.INI file?
Thanks for the reply,
Pat
""Hans H. Anderson"" <me@hansanderson.com> wrote in message
news:Pine.LNX.4.10.10008260009350.2358-100000@anywhere.atican.com...
>
> probably something like this:
>
> $string = "
> PING 1.1.1.1 (1.1.1.1): 56 data bytes --- 1.1.1.1 ping statistics --- 1
> packets transmitted, 0 packets received, 100% packet loss";
>
> ereg("([0-9]{1,3})%",$string,$p);
> $percent = $p[1];
>
> There are also some PHP4 Perl like regex functions (preg, etc), but I
> haven't used them yet.
>