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

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -