Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regular Expression Not Fully Simplified #19

Open
dylanmorroll opened this issue Feb 18, 2018 · 1 comment
Open

Regular Expression Not Fully Simplified #19

dylanmorroll opened this issue Feb 18, 2018 · 1 comment
Labels

Comments

@dylanmorroll
Copy link

Hi there, I've just noticed that when
(a+b)(b+$)*(b+$)+a+b
is fed into the Regular Expressions Gym, it simplifies to
(a+b)b*(b+$)
However I'm pretty sure the fully simplified regular expression should be
(a+b)b*
Since if you expand the (a+b)b* onto (b+$) you get (a+b)b*b+(a+b)b* which can be simplified to (a+b)b*?

@izuzak
Copy link
Owner

izuzak commented Feb 18, 2018

Thanks for the report, @dylanmorroll! Yeah, I agree that the regex in question could be simplified more.

There's a specific simplification rule just for that case, and it seems it kicks in as expected when you try to simplify this:

b*(b+$)

but it doesn't kick in when you try to simplify this:

(a+b)b*(b+$)

And it should kick in just the same. Not sure why it's not, though. I probably won't have time to investigate in the near future, so if someone else wants to dig in and open a pull request to fix this -- I'd be happy to review and merge! 👍

@izuzak izuzak added the bug label Feb 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants