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

feat!: escape {} templates #364

Closed
wants to merge 2 commits into from

Conversation

nobkd
Copy link
Collaborator

@nobkd nobkd commented Sep 13, 2024

fix #252

You can now use the following in html:

  • ^\d\{4,5}$ -> ^\d{4,5}$
  • ^\d\{4,5\}$ -> ^\d{4,5}$
  • ^\d{4,5\}$ -> ^\d{4,5}$

E.g. <input type="text" name="captcha" value="" placeholder="" required pattern="^\d\{4,5\}$" />
For \{ as result double escaping is needed now: \\{ -> \{ (html syntax) (would be \\\\{ -> \\{ in js strings)

You still cannot do something like:

  • {'\{fails\}'} -> {'{fails}'} (does not result in maybe expected: '{fails}')

PS: I'm not sure, if this should be merged, as it adds a bit of complexity to the regexp and has to recombine some strings to get back the expected format...

PPS: This might be breaking code for some people, but not really. It has parity with templates from before, but because of the new \{ / \} escaping, some (very small amount of) code has to change a little bit.

@nobkd nobkd changed the title feat: escape {} templates feat!: escape {} templates Sep 13, 2024
@nobkd nobkd added the nuejs-core Related to nuejs-core package label Sep 22, 2024
@nobkd nobkd closed this Oct 4, 2024
@nobkd nobkd deleted the feat/escape-variable-replacers branch October 4, 2024 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nuejs-core Related to nuejs-core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When '{}' or',' in html , How to escape?
1 participant