Reputation: 465
I need to check if a string matches ORA-16252: unable to extend segment by <any value> in tablespace
. Here <any value>
can be any number. How do I match the string in python? Is there a regular expression for that?
Upvotes: 0
Views: 716
Reputation: 21418
regex = re.compile(r'ORA-16252: unable to extend segment by \d+ in tablespace')
if regex.match(s):
...
Upvotes: 3
Reputation: 213391
\\d+
is used to match one or more number of digits is continuity. So, you can just add it in place of your <any value>
to match any number.
Rest of the strings, since it does not vary as you are saying, keep it as it is.
m = re.search(r'ORA-16252: unable to extend segment by \d+ in tablespace',
yourString)
if m is not None:
# set your value
Upvotes: 0