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

When '{}' or',' in html , How to escape? #252

Open
yuhengliang opened this issue Apr 5, 2024 · 1 comment
Open

When '{}' or',' in html , How to escape? #252

yuhengliang opened this issue Apr 5, 2024 · 1 comment
Labels

Comments

@yuhengliang
Copy link

yuhengliang commented Apr 5, 2024

<input type="text" name="captcha" value="" placeholder="" required pattern="^\d{4,5}$" />

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

@nobkd
Copy link
Collaborator

nobkd commented Apr 7, 2024

I thought, something like this pattern="{'^\d{4,5}$'}" or this :pattern="'^\d{4,5}$'" would work, but it seems, the shortest match of {} is taken resulting in pattern="{'^\d45$'}" and pattern="'^\d45$'" respectively

So you currently have to do for example something like the following:

<div>
  <p>e.g. a layout component or area or some other scope</p>
  <input type="text" name="captcha" value="" placeholder="" required :pattern />
  <!-- or -->
  <input type="text" name="captcha" value="" placeholder="" required :pattern="patternvar" />

  <script>
    pattern = '^\d{4,5}$'
    // or
    patternvar = 'some pattern'
  </script>
</div>

Hope that helps, at least until there is a proper fix :)

@nobkd nobkd added the bug label Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants