Regular Expression including quote (") and end of line

Do you have anything to share with other users? Your opinions about our programs, suggestions for future products - everything goes here.
Post Reply
whiri02
Posts: 23
Joined: Tue Oct 12, 2004 2:23 pm
Location: UK

Regular Expression including quote (") and end of line

Post by whiri02 »

Hi there CompareIt users.
I am trying to use regular expressions to ignore the last field in a CSV file.
The field is a timestamp in the format "07/03/2005 17:19:18", and it does have the double quotes surrounding it.

I am familiar with regex in unix commands and was intending to use the $ as the end of line anchor.
But I cant get it to work, I wanted to used "\d\d\/\d\d\/200\d\s\d\d:\d\d:\d\d"$ as regex, but that doesnt work.
\d\d\/\d\d\/200\d\s\d\d:\d\d:\d\d on its own, without the quotes and $ seems to work well, but is not limited to the last field.

It seems to me that either the " or the $ is causing my regex to fail. I've tried escaping the quote as \", but no joy.

Any suggestions or comments
TIA

Ro Ablate
Posts: 41
Joined: Mon Dec 22, 2003 5:49 pm

Post by Ro Ablate »

Truly just a wild guess - maybe the library he uses considers a forward slash a reserved character? Try escaping the forward slash with a back slash and see if that helps.

whiri02
Posts: 23
Joined: Tue Oct 12, 2004 2:23 pm
Location: UK

Thanks

Post by whiri02 »

Well thanks for your thoughts - I reviewed my regex 1 more time and used
\d\d\/\d\d\/200\d\s\d\d:\d\d:\d\d\"$
and it works! I think I was escaping the $ last time as well as the quote. Dohh 'user error' again. :oops:

Just one comment though, the help on regex mentions several special chars that require \ to escape them, and does not mention " quote anywhere. :shock:

grigsoft
Site Admin
Posts: 1673
Joined: Tue Sep 23, 2003 7:37 pm
Contact:

Post by grigsoft »

Thank you, I will update description - http://www.grigsoft.com/wincmp3/help/so ... ssions.htm really doesn't include this as special character

Post Reply