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


  • Hi,

    how do you build the parse tree?

    this one, e.g. could be

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

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

    - 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.


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