match trailing slash with Python regex -
I try to match a previous / this way:
type ( Re-match '/ $', U'https: // xxx / ')) & lt; Type 'Any Type' & gt;
However, it matches any:
type (re-match ('. * / $', U'https: // xxx / ')) & Lt; Type '_sre.SRE_Match' & gt;
The use of the first parallel pattern is:
perl -e 'print "true" if "https://example.org/"
Again Match
Find the string from the beginning of your string Since your string '/', again Mitch ('/ $', u'https: // xxx / ') does not start with
does not return anything.
You need to use re.search ('/ $', u'https: // xxx / ')
to search your previous slash.
Comments
Post a Comment