how to convert a string into regex javascript code example Example: js string to regex const regex = new RegExp('https:\\/\\/\\w*\\.\\w*.*', 'g');