regex - Simplify this regular expression -


i'm doing pre-exam exercises compilers class, , needed simplify regular expression.

(a u b)*(a u e)b* u (a u b)*(b u e)a* 

quite obviously, e empty string, , u stands union.

so far, think 1 of (a u b)* can removed, union of u = a. however, can't find other simplifications, , not doing other problems far. :(

any appreciated, much!

little rusty on regex, if * still represents "zero or more ocurrences" can replace:

(a u e)b* (a u b)* 

which leaves first part with:

(a u b)*(a u b)* = (a u b)* 

on right side, have

(b u e)a* = (b u a)* 

now, since u b = b u a, get:

(a u b)*(a u b)* 

on right hand side, leaves just

(a u b)* u (a u b)* = (a u b)* 

i think that's it...


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -