euscanwww: Removing useless stuff while creating watch tag
* Removing useless options or actions * Fixing handling of substitution regex Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
@ -26,7 +26,11 @@ def can_handle(pkg, url):
|
||||
def parse_mangles(mangles, string):
|
||||
for mangle in mangles:
|
||||
# convert regex from perl format to python format
|
||||
# there are some regex in this format: s/pattern/replacement/
|
||||
m = re.match(r"s/(.*[^\\])/(.*)/", mangle)
|
||||
if not m:
|
||||
# or in this format s|pattern|replacement|
|
||||
m = re.match(r"s\|(.*[^\\])\|(.*)\|", mangle)
|
||||
pattern, repl = m.groups()
|
||||
repl = re.sub(r"\$(\d+)", r"\\\1", repl)
|
||||
string = re.sub(pattern, repl, string)
|
||||
|
Reference in New Issue
Block a user