1

I have a large list of javascript regular expressions and want to use them with Python.

My question is, how much both regex types differ and if I could simply use pythons re. I was able to compile all expressions in the list without error, but does this guarantee that the expressions match the same strings in any case?

If this doesn't work in general, what would be a reliable way to automatically translate the javascript regex to python regex?

Pecos
  • 19
  • 3
  • 1
    Majority of tokens and constructs that JavaScript's regex engine supports are also supported in python. I don't think you'll run into issues porting it from JavaScript from python, especially if your regular expressions are more or less *normal*. If you do run into any issues, you can look into python's `regex` package, but I doubt that'll be a case. – ctwheels Feb 08 '18 at 18:24
  • I'm pretty sure that you should be _mostly_ ok going from JavaScript to Python, but there _would_ be problems going in the opposite direction. – PM 2Ring Feb 08 '18 at 18:30

0 Answers0