Error in regular expression
Posted: Sun Nov 19, 2006 4:11 pm
Hello,
I've just started getting involved with regular expressions and am getting an error I can't fix.
What I am trying to do is isolate all the text in a string that falls between '(' and ')', and also between '[' and ']'.
This is the expression that I am using:
And the error that I get:
Thanks for your help,
ddeschn
PS...
Example input would be:
(Said with joy.) So glad to see you! [SARCASTICALLY NOW] I am so surprised.
Output would be:
(Said with joy.) [SARCASTICALLY NOW]
I've just started getting involved with regular expressions and am getting an error I can't fix.
What I am trying to do is isolate all the text in a string that falls between '(' and ')', and also between '[' and ']'.
This is the expression that I am using:
Code: Select all
$paren = split("(?:(\()|(\[))[^()[]]*(?(1)\)|\])", $row['line']);Code: Select all
Warning: split() [function.split]: REG_BADRPT in /home/ddeschn/public_html/chinook/index.php on line 89ddeschn
PS...
Example input would be:
(Said with joy.) So glad to see you! [SARCASTICALLY NOW] I am so surprised.
Output would be:
(Said with joy.) [SARCASTICALLY NOW]