RE: Regular Expression Backreference in subpattern.

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

 



Not sure what you think the (?P is doing, but it looks very suspicious to me...

I'm no PCRE expert though...

Try this:

'|<td>\\s*charge\\s*</td>\\s*<td>\\s*([0-9]*)\\s*</td>|'

\\s allows for whitespace

If you only want ones that HAVE to have numbers, and no blanks, change * after the 0-9] bit into +

________________________________________
From: Shiplu [shiplu.net@xxxxxxxxx]
Sent: Saturday, September 27, 2008 10:24 AM
To: PHP General
Subject:  Regular Expression Backreference in subpattern.

The string is "<td>charge</td><td>100</td>".
I want and array( "charge"=>100).
I am using this regular expression,
'/<td>([^<]+)<\/td><td>(?P<\1>\d+)<\/td>/'.


But its not working..

I get this error.,
PHP Warning:  preg_match(): Compilation failed: syntax error after (?P
at offset 25 in E:\src\php\WebEngine\- on line 4

any idea?

--
Blog: http://talk.cmyweb.net/
Follow me: http://twitter.com/shiplu

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


_______________________________________________________

The  information in this email or in any file attached
hereto is intended only for the personal and confiden-
tial  use  of  the individual or entity to which it is
addressed and may contain information that is  propri-
etary  and  confidential.  If you are not the intended
recipient of this message you are hereby notified that
any  review, dissemination, distribution or copying of
this message is strictly prohibited.  This  communica-
tion  is  for information purposes only and should not
be regarded as an offer to sell or as  a  solicitation
of an offer to buy any financial product. Email trans-
mission cannot be guaranteed to be  secure  or  error-
free. P6070214

-- 
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