-
Notifications
You must be signed in to change notification settings - Fork 951
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
Newline substitution. #11
Comments
Right, we currently limit the Expression and Substitution fields to single line input. I've considered treating the Substitution value as a Javascript string, so you can use "\n" and other encoded characters. Open to feedback on this. |
This is the originating request: http://stackoverflow.com/questions/22751526/regexr-com-substitution-with-new-line-feed I'm sure "peter-lee" on SO would love to talk to you more about it :) |
Great tool, but newline/tab substitution is the thing I stuck with. |
This also causes inconsistencies with the Share>Copy>Javascript workflow, because \n in the substitution is not decoded in RegExr, but is in JS. To resolve this, I propose leveraging JSON.parse to decode escaped characters, and adding support to the SubstLexer to include highlighting / tooltips for them as well (ideally sharing code with the RegExLexer). I might take a stab at this when I have some time.
|
A little more info: This seems like a better solution, but requires appropriate error handling:
|
The ability to clean up data (including newlines) and format text is the primary reason I tend to use regexr. I don't use regexp often enough to remember all the rules off the top of my head, so having regexr makes life very easy - except I can no longer insert special characters in the substituion. Which renders 2.0 almost completely broken for all my use cases. |
I just pushed a solution to this, supporting all JS escaped character formats, with appropriate errors and tooltips. This should be live in the next couple days. |
This is now active on the live site. I'd love any feedback you have. |
So a quick look this morning shows the new site now works like a charm for the kinds of things I tend to use Regexr for. Thank you! |
It appears to currently be impossible to substitute a newline in the output. This might be a limitation of the code mirror framework in use.
The text was updated successfully, but these errors were encountered: