firasdib / Regex101

This repository is currently only used for issue tracking for www.regex101.com
3.28k stars 199 forks source link

Python should be divided into two parts #1219

Open A-hoy opened 5 years ago

A-hoy commented 5 years ago

Feature

Due to regex engine in Python 3.7+ (contain 3.7) is different form Python 3.6 and below, Python should be divided into two parts. Regex101 only supports the eariler versions.

Take '\d*?|x' for example:

run in regex101:

re

run in Python 3.6:

Python 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 14:02:33) [MSC v.1915 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> re.sub(r'\d*?|x', '-', 'x1')
'-x-1-'

run in Python 3.7:

Python 3.7.3 (default, Apr 24 2019, 13:20:13) [MSC v.1915 32 bit (Intel)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> re.sub(r'\d*?|x', '-', 'x1')
'-----'
firasdib commented 4 years ago

Nice find. It looks like the newer versions align better with PCRE, and perhaps that flavor can be used instead?