ok, I have a problem here, in my database I store regexPath that made from URL. I used this package path-to-regex
so I store my converted path to regex as String in the database like this:
let path = "/v1/manager/notification/all"
let regexPath = "/^\/v1\/manager\/notification\/all(?:\/)?$/i"
and I need test() function for checking some condition. ofcourse test() function need a regex format for checking value is exists in regex.the only way I found in internet for convert string to regex is :
let RegexPattern = new RegExp(regexPath)
but RegExp function consider my i tag as a part of regex him self and it returns something like this:
/"\/^\\\/v1\\\/manager\\\/notification\\\/all\\\/page\\=([^\\=\\\/]+?)(?:\\\/)?$\/i"/
how should I solve this problem?