<?xml version="1.0" encoding="windows-1252"?>
<node id="990816" title="Re^2: Regex: Identifying comments" created="2012-08-30 14:29:06" updated="2012-08-30 14:29:06">
<type id="11">
note</type>
<author id="920017">
pvaldes</author>
<data>
<field name="doctext">
&lt;p&gt;IMHO the basic problem with your sql files is that don't look really like sql files, thus anything can be a comment and anything can be wrong, even if perl is acting fine.&lt;/p&gt;

&lt;p&gt;I don't know all databases in the whole world so don't take this advice as immutable, of course, but sql sentences normally aren't complete (and don't run) until you find a semicolon. Is also surprising that you could select a field named '--foo' when you can't even create a table like this:&lt;/p&gt;

&lt;c&gt;create table (--foo int);  # error
create table ('--foo' int);  # error
create table ("--foo" int);  # error
create table (\-\-foo int); # big error&lt;/c&gt;

&lt;p&gt;So you are probably trying to solve a nonexistent problem. Comments are always &lt;i&gt;after&lt;/i&gt; a semicolon or in your own line. And it you have i.e this:&lt;/p&gt;

&lt;c&gt;-- ; select * from mytable where foo = "--34"; -- hi ', hi'. "hi'&lt;/c&gt;

&lt;p&gt;The complete line IS a comment here. I'm quoting lines that I don't want to run (temporally) all the time in sql files, it's not unusual to see something like this.&lt;/p&gt;

&lt;p&gt;So you should be pointing your arrows to ";" instead to "'". You probably should check and sanitize first what's in your files, before to pass this files to perl&lt;/p&gt;</field>
<field name="root_node">
990479</field>
<field name="parent_node">
990750</field>
</data>
</node>
