D
D
Dimash Kenzhegaliev2021-11-27 01:09:00
JSON
Dimash Kenzhegaliev, 2021-11-27 01:09:00

How to insert regex into json?

I have a regular expression like this: /\(?([0-9]{3})\)?([ .-]?)([0-9]{3})\2([0-9]{ 4})/
but in general it can be anything,
I need to send it in json format,
I went to this site: https://www.freeformatter.com/json-escape.html#ad-...
and formatted regex there to json and got this: \/\\(?([0-9]{3})\\)?([ .-]?)([0-9]{3})\\2([0- 9]{4})\/
it is passed but doesn't work because it has two characters in a row \\
is it possible to pass regex to json normally somehow?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question