From all the parsing packages I have used so far pyparsing gave me result straight away even with not all the possiblilties explored.
But... what do I need to do to get a '\' parsed as part of the text between " and " like in:
dblQuotedString does not handle the \\. to be more precise it stops parsing at the position of \, with an error Expected '"' when
I used dblQuotedString.setDebug()
With best regards.
You may wish to create your own special quoted string definition for this case. Here is a very simple-minded one:
from pyparsing import *
test = r'Here is a quoted filespec: "G:\Folder name\filename.extension" '
QUOTE = Literal('"').suppress()
quotedFilespec = Combine( QUOTE + CharsNotIn('"\n\r') + QUOTE )
for t,s,e in quotedFilespec.scanString(test):
This quotedFilespec will not do any special handling of backslashes, so it will work well for you for quoted strings that contain Windows filespecs.
Ok, working around is good. I was focussed on options in the dblQuotedString.
Thank you for the example. It worked for me.
With best regards,
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.