RE: Re: preg_match question...

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

 



hmmm...

tried your preg__match/regex...

i get:
0 - 1145 total
1 - 1145
2 - l

i would have thought that the 2nd array item should have had "total"...



-----Original Message-----
From: Frank Stanovcak [mailto:blindspotpro@xxxxxxxxxxx]
Sent: Friday, February 06, 2009 6:15 AM
To: php-general@xxxxxxxxxxxxx
Subject:  Re: preg_match question...



""bruce"" <bedouglas@xxxxxxxxxxxxx> wrote in message 
news:234801c98863$88f27260$0301a8c0@xxxxxxxxxxxx
> 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..
>

How about
preg_match('#(\d+)(.)+#',$haystack,$match)

if I remember right
$match[0] would be all of it
$match[1] would be the numbers
$match[2] would be the text 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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