-
Notifications
You must be signed in to change notification settings - Fork 169
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
Add feature for formatting and indenting regexes on multiple lines #17
Comments
I came looking for an issue like this and was pleased that it had already been raised. IMO, anything with more than a few moving parts should automatically have the /x switch. The corollary, though, is that if the generated regexp would contain large sequences of text including spaces, and turning on the /x flag would replace all the spaces with escaped spaces, then said large sequences of text should instead be quoted with \Q and \E. As it is, if you take a handful of memorable phrases from e.g. the Declaration of Independence, you get the following:
(I don't know why the hyphen is escaped there, incidentally.) As a human, I'd write the resulting regexp something like this:
|
Hi @skington, thanks for your input. I haven't found the time so far to continue the development of grex but as soon as I find the time, I will consider your suggestions. Feel free to send me a pull request if you are not afraid of the code. ;) |
Generated regular expressions which are very long are often hard to read. It would be useful to have an option to indent and format the generated regexes on multiple lines to make them more readable.
The text was updated successfully, but these errors were encountered: