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

Enhancements to absent operator examples #22

Open
tom-lord opened this issue Feb 3, 2018 · 0 comments
Open

Enhancements to absent operator examples #22

tom-lord opened this issue Feb 3, 2018 · 0 comments

Comments

@tom-lord
Copy link
Owner

tom-lord commented Feb 3, 2018

The "best" way to replicate generating examples for absent operator groups is with a negative lookbehind, e.g:

(?~abc) --> (?:.(?<!abc))*

But since look-behinds are irregular, this library cannot support that! A possible workaround would be to replace the group with a repetition of the first letter negated, e.g:

(?~abc) --> (?:[^a]*)

However (!!) this generalisation is not always possible:

(?~\wa|\Wb) --> ???

Therefore, the only 100% reliable option - which is what this gem currently does - is just to match "nothing"!

/(?~abc)/.examples #=> [""]

However, as shown above, this library could, at least, be enhanced to deal with specific scenarios in better ways. But such a strategy needs to be optimised for generalisation and reliability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant