python - \Z doesn't match end of string -


i have regex (?p<url>http.{1,}?[\s)\z]) find url ending in \s character, close parenthesis, or end of string, matches first 2 cases.

how match third (end of string)?

\z doesn't work inside character sets - matches z (most features disabled inside character class, including ., +, etc. other character classes work: \w, \d, etc).
want use alternation: (?:[\s)]|\z).

in addition, .{1,}? same .+?, whole pattern can written as

(?p<url>http.+?(?:[\s)]|\z)) 

Comments

Popular posts from this blog

node.js - StackOverflow API not returning JSON -

python - Subclassed QStyledItemDelegate ignores Stylesheet -

sql server - TFS 2012 TF255062 Error after removing 'Active Directory' Role -