On 08/04/2006 04:26 AM, Paul Beckett wrote:
I'm trying to pattern match the beginning of a SQL string like:
INSERT INTO `rwikiobject` VALUES
('0b5e02f308c5341d0108fca900670107','2006-03-06
23:36:41','/site/ec07580d-1c66-469f-80be-c0afd616cedf/alembert, d
\'','/site/ec07580d-1c66-469f-80be-c0afd616cedf'
My expression so far looks like:
my ($id, $version, $name, $realm) = $object =~ /INSERT INTO
`rwikiobject` VALUES \('([a-z0-9]{32})','(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:
\d{2})','(\/site\/[^']+)','\/site\/([^']+)'/;
This is working great, except for a few cases (like the example string
above where the third field 'name' has an "escaped apostrophe": \'
Do I need a reverse looking assertion to overcome this? If so, I would
really appreciate a hand with the syntax of that. If not, any ideas how
I can match this field: which is of unknown length, and can contain any
character / symbol, including the escaped form of the apostrophe, which
is also the field delimiter.
Thanks in advance,
Paul
Use Text::Balanced. The extract_delimited function will be the
most useful.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>