RE: [PHP] Regular Expression Backreference in subpattern.
| From: | Richard Lynch | Date: | Sat, 27 Sep 2008 16:52:32 +0000 |
| Subject: | RE: [PHP] Regular Expression Backreference in subpattern. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-281048@lists.php.net to get a copy of this message | ||
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@gmail.com]
Sent: Saturday, September 27, 2008 10:24 AM
To: PHP General
Subject: [PHP] 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