I have something like
store(s)
ending line like 1 store(s) .. I want to match , it using python regular expression.
I
In more or less direct reply to your comment
Try this
import re s = '1 stores(s)' if re.match('store\(s\)$',s): print('match')
The solution is to use re.search
instead of re.match
as the latter tries to match the whole string with the regexp while the former just tries to find a substring inside of the string that does match the expression.
have you considered re.match('(.*)store\(s\)$',text)
?
Python offers two different primitive operations based on regular expressions: match checks for a match only at the beginning of the string, while search checks for a match anywhere in the string (this is what Perl does by default)
Straight from the docs, but it does come up alot.