-
Notifications
You must be signed in to change notification settings - Fork 32
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
Explore other solutions #38
Comments
The first thing to do is probably to find a reasonable name for |
|
Oh, and judging from the discussion in #37 there seems to be confusion on what such a tagging function would return. Everyone seems to expect a string (that needs to be passed into the
|
It should probably only return a RegExp instance, otherwise all of the same compositional problems will exist as do with Changing the flags is trivial by wrapping in the constructor: |
I am pleased to bring https://github.com/mikesamuel/regexp-make-js to your attention. @mikesamuel and I (mostly Mike) put together this draft informal specification and prototype implementation for what the RegExp template string tag should be. We think this is a comprehensive and principled approach ready for examination and discussion. Would it be better to discuss this here on this thread, or over at https://github.com/mikesamuel/regexp-make-js ? This prototype implementation currently uses some ES6 features that are directly implemented only on Firefox. After reading the README, I suggest reading the tests next while visiting https://rawgit.com/mikesamuel/regexp-make-js/master/test.html in a Firefox browser. I think the tests should quickly clear up most questions about what the draft spec means. Please point out any ambiguities that remain. Thanks! |
@erights A new repository seems suited for discussion of this particular approach. As you can see, I've just opened 6 issues there :-) |
@erights that proposal looks abandoned, status? |
So, the results are in, and it seems they declined
RegExp.escape
and this is a final decision.What alternatives do we have? Of course we could just fall back on a user-land implementation (like ljharb/regexp.escape, are there others?) as mentioned, but what if we want to press on?
RegExp.fromString
, Alternate proposal: RegExp.fromString #33, with regex combinators asRegExp.prototype
methods, to provide a fluent interface for regex construction/combinationRegExp.tag
, for template strings, avoids double-escaping by accessing the.raw
template parts, and solves the problem with trailing backslashes (example)Both do have a problem with flags though, which are difficult to express. Is there anything else?
The text was updated successfully, but these errors were encountered: