Re: preg_match question...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



preg_match('/^([0-9]+) (.)+/',$sString,$aMatches);

Matches will be 1 => the number ; 2 => the text. The expression only matches
if there is any character after the space.  Not necessarily text, it might
be another number or special characters

2009/2/6 bruce <bedouglas@xxxxxxxxxxxxx>

> hi...
>
> trying to figure out the best approach to using preg_match to extract the
> number from the follwing type of line...
>
> " 131646 sometext follows.."
>
> basically, i want to extract the number, without the text, but i have to be
> able to match on the "text"
>
> i've been playing with different preg_match regexs.. but i'm missing
> something obvious!
>
> thoughts/comments..
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Alpar Torok

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux