Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Formating this string
- Bartosz Wegrzyn
April 8, 2005, 5:59 am
rate this thread
Re: Formating this string
while everyone's code works..
(actually, I'm not sure about the examples with \< and \> in the
expression... "<" and ">" need not be escaped. )
anyhow, here's my take:
$string = 'aaa.bbb.ccc.com <20000>';
if ( preg_match('/<(\d+)>/',$string,$matches) )
$num = $matches; // $num in this example is now '20000'
// no num inside <> found