0

I have this regex in a java file that needs to be implemented in a JS file.

^[\p{Print}\n\r\\xa1-\xff]*$

I am having trouble getting it to work the same way.

If there is a tool somewhere for this, please share it here. Thanks!

AdamHinckley
  • 215
  • 4
  • 16
  • Does that regex not work in JS? There's no actual Java code here – evolutionxbox Jan 06 '21 at 17:23
  • 1
    Also, note that if you want to match any non-control chars with `\p{Print}`, you may use `/^[\P{C}\n\r\xa1-\xff]*$/u` in JS. – Wiktor Stribiżew Jan 06 '21 at 17:26
  • @evolutionxbox regex in Java is a little bit different. One difference is using two backslashes instead of one in some areas. – AdamHinckley Jan 06 '21 at 19:10
  • @WiktorStribiżew thanks for the tip. Unfortunately, that regex does not work exactly the same as the one I provided. `Ž` is not supposed to pass, but it does with what you provided. – AdamHinckley Jan 06 '21 at 19:16
  • Did you check the duplicate thread? ``/^[a-z0-9!"#$%&'()*+,.\/:;<=>?@\[\] ^_`{|}~-]*$/i`` cannot match `Ż` nor `Ź`, etc. Add your `\n\r\xa1-\xff` if necessary. – Wiktor Stribiżew Jan 06 '21 at 19:29

0 Answers0