Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Terminals as regular expresions #8

versae opened this Issue · 4 comments

2 participants


I need to build a grammar from user inputs, and I was trying to do something like this

parsley.makeGrammar("d = '{test}'".format(test="TeSt"), {})("TeSt").d()

But having {test} case insensitive, so I tried the next

parsley.makeGrammar("d = '(?i){test}'".format(test="TeSt"), {})("TeSt").d()
parsley.makeGrammar("d = (?i)'{test}'".format(test="TeSt"), {})("TeSt").d()

But none of them worked. Is there any way to achieve that?


Any update on this?

I almost got it working using this ugly rule

import re
parsley.makeGrammar("d = anything*:x !(re.compile('(?i){test}').match(''.join(x)) and ''.join(x))".format(test="TeSt"), {"re": re})("TeSt").d()

having an re() rule that took a regular expression could be interesting. let me know what you come up with :)


Any advance on this? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.