diff options
author | Paul McGuire <ptmcg@users.noreply.github.com> | 2019-10-21 23:31:23 -0500 |
---|---|---|
committer | Paul McGuire <ptmcg@users.noreply.github.com> | 2019-10-21 23:31:23 -0500 |
commit | 03f74f2038fbb13bd1677e988cc5ef21c2d6d4cc (patch) | |
tree | 5b6665bc018c827f3f29614019ec8279fd19711e | |
parent | f91b27fed996060b1189325cc12097b0a985e012 (diff) | |
download | pyparsing-git-03f74f2038fbb13bd1677e988cc5ef21c2d6d4cc.tar.gz |
Remove reference to overriding imported re with regex module for now
-rw-r--r-- | pyparsing.py | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/pyparsing.py b/pyparsing.py index 6a8a925..2d6f652 100644 --- a/pyparsing.py +++ b/pyparsing.py @@ -3258,9 +3258,7 @@ class Regex(Token): If instead of the Python stdlib re module you wish to use a different RE module (such as the `regex` module), you can replace it by either building your - Regex object with a compiled RE that was compiled using regex, or by replacing - the imported `re` module in pyparsing with the `regex` module: - + Regex object with a compiled RE that was compiled using regex: Example:: @@ -3269,18 +3267,11 @@ class Regex(Token): # ref: https://stackoverflow.com/questions/267399/how-do-you-match-only-valid-roman-numerals-with-a-regular-expression roman = Regex(r"M{0,4}(CM|CD|D?{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})") + # use regex module instead of stdlib re module to construct a Regex using + # a compiled regular expression import regex parser = pp.Regex(regex.compile(r'[0-9]')) - # or - - import pyparsing - pyparsing.re = regex - - # both of these will use the regex module to compile their internal re's - parser = pp.Regex(r'[0-9]') - parser = pp.Word(pp.nums) - """ def __init__(self, pattern, flags=0, asGroupList=False, asMatch=False): """The parameters ``pattern`` and ``flags`` are passed |