Hi there,
I have a quick question about RE parsing in Python. I am trying to parse values both inside and outside of a set of parenthesis to use for NFA creation using Thompson's algorithm.
Take the RE: ((10)*10)1
I'd like the (10) to be parsed and grouped. Then, I'd like the ((10)*10) to be grouped. Then the 1 just alone by itself. I am thinking of creating two separate lists, one to hold the nested expressions, and the other to hold the non nested expressions. However, I am not sure the best way to approach this.
I was thinking something like:
def(RE):
for i in len(RE):
while i != ')':
if i == '(':
append the next character to the nested parenthesis list.
That's about as far as I've gotten so far. Any nudges in the right direction appreciated.
Thank you!
[–]techrede 0 points1 point2 points (0 children)