Comments (9)
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.
from regexr.
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 :)
from regexr.
Great tool, but newline/tab substitution is the thing I stuck with.
from regexr.
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.
JSON.parse('"'+subst+'"'); // should decode all escaped chars.
from regexr.
A little more info: This seems like a better solution, but requires appropriate error handling:
try { str = eval('"'+str.replace(/"/g,'\\"')+'"')); } catch(e) { /* etc */ }
from regexr.
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.
from regexr.
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.
from regexr.
This is now active on the live site. I'd love any feedback you have.
from regexr.
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!
from regexr.
Related Issues (20)
- PCRE engine matches รค (ASCII char 228) to other diacritics
- Separator not working for list tool for PCRE patterns
- Issue with Regex Tool's Lack of Support for Lazy Quantifier "{,M}" Without Lower Limit HOT 2
- Site is down with "connection timed out, Error code 522" HOT 1
- Support for `v` (`unicodeSets`) and `d` (`hasIndices`) flags HOT 3
- Support for named backreferences `\k<...>`
- i love you, whoever made this.
- \n not working as expected HOT 1
- Global indicator not working in tests HOT 1
- When nearby matches are present, hard to see visually.
- full match not working in test
- can't build it? HOT 1
- Hide Text/Tests pane
- Explain PCRE modes like `(?i)` more
- Feature request: Paste lines to be used for tests HOT 2
- Inconsistent / broken pattern matching for unicode letters in PCRE mode
- Feature Request: Change default author
- Cannot delete Pattern created by '[anonymous]'
- [Feature Request] Import multiple tests using a file text or a csv list or json list...
- Chromium browsers cannot append text after space character HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from regexr.