note 4150 deleted from ereg by jmoore
| From: | jmoore@php.net | Date: | Wed, 14 Feb 2001 20:12:08 +0000 |
| Subject: | note 4150 deleted from ereg by jmoore | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-11072@lists.php.net to get a copy of this message | ||
If you have a string that contains something in the form <br><pre>
$s= "-49 This is my data";
</pre><br>
and you want to get two variables $a="-49"; and $b="This is my data"; you can
use the expression<br><br><pre>
eregi ("([[:graph:]]*)[[:space:]]*(.*)", $reason, $values);</pre>
<br>You should use this as opposed to<pre>eregi ("(.*)[[:space:]]*(.*)",
$reason, $values);</pre><br>to avoid greedy matching. This works but can anyone let me
know a better way of doing this?