locked
Regex RRS feed

  • Question

  • Hallo everybody. is there anybody can help me? I have known simple regular expression such as : ab*|ba and then i change this expression into parse tree. But seems that there is complete regex such as : a[a|b]|c.

    My question is how to build the parse tree from the complete Regex? I am very confused about this. Please help me.

    Sunday, April 17, 2011 1:55 AM

Answers

  • Hi,

    how do you build the parse tree?

    this one, e.g. could be

    OR
    - AND
      - a
      - SET [|ab]
    - c

    You can split the set into ORed characters, too, so it's

    OR
    - AND
      - a
      - OR
        - |
        - a
        - b
    - c 

    But (because of character set negation and character set subtraction), I wouldn't do that..

    Remind that, your set [a|b] consists of 3 characters! There's no OR-Operator inside character classes.

    Greetings,


    Wolfgang Kluge
    gehirnwindung.de
    • Marked as answer by Paul Zhou Monday, April 25, 2011 3:38 AM
    Monday, April 18, 2011 7:56 AM