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

Syntax for regex operations #89

Open
lynn opened this issue Sep 2, 2020 · 0 comments
Open

Syntax for regex operations #89

lynn opened this issue Sep 2, 2020 · 0 comments

Comments

@lynn
Copy link
Contributor

lynn commented Sep 2, 2020

#56 suggests some new atoms that perform regex operations, but perhaps it'd be better to introduce a new kind of "string start" that syntactically starts a regex, with its own set of terminators that each corresponds to a regex operation.

This would be a good use for (, which doesn't have meaning yet.

For example, #56 proposes

œF: Regex Findall: Find all instances of regex x in string y; return a list of matches

And “[a-z]”œF is 9 bytes, but something like ([a-z]Ḟ is only 7. (Here would be the regex terminator for “findall”).

Instead of “[a-z]+”UÐR, we'd write U([a-z]+Ṙ. So is a regex terminator that makes the result act as a quick.

It also makes sense to introduce all kinds of “macros” within the regex syntax. For example, could be short for [a-z], and ¹ for \1. And of course, Ɗ makes a (...) group out of the previous three regex tokens.

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

No branches or pull requests

1 participant