I am using a simple Perl script to parse XML and convert it to usable SQL. My current SQL lines go something like this:
INSERT INTO table VALUES ('data1', 'data2', 'data3', );
Obviously I need to remove the comma at the end there. Sounds simple but I just can't get regex to find it. I tried s/,\s+)/)/ but that doesn't change anything when I run it. Strangely, s/,\s+/WTF/ doesn't modify anything either, when it should be replacing all the commas and the spaces next to them. BUT when I run s/\s+)/something/ it correctly finds and replaces the close parentheses at the end of the line. So apparently the whitespace character right after the commas is some strange ghost character that I can't find by any means. Not even with the . expression.
What's really weird though is when I use Find on the document in Notepad++ with the Regular Expression option, it finds all of them perfectly when I enter ,\s+) yet the exact same sequence in Perl regex will not find them.
I suspected it was something with \r (I'm using Windows) since I previously removed the \n characters but it won't find a \r in the whole sql file.
Thank you in advance for your help this is really puzzling me.