Answers for "how to check regex python"

1

check string equal with regular expression python

import re
pattern = re.compile("^([A-Z][0-9]+)+$")
pattern.match(string)
Posted by: Guest on May-10-2020
0

check if valid regex string python

import re
string = '['
try:
    re.compile(string)
    is_valid = True
except re.error:
    is_valid = False
Posted by: Guest on September-06-2020
4

re python3

import re
>>> m = re.search('(?<=abc)def', 'abcdef')
>>> m.group(0)
'def'
Posted by: Guest on February-03-2020

Python Answers by Framework

Browse Popular Code Answers by Language