Revision 60
Added by Aaron Marcuse-Kubitza almost 13 years ago
scripts/util/simplify_xpath | ||
---|---|---|
10 | 10 |
line = sys.stdin.readline() |
11 | 11 |
if line == '': break |
12 | 12 |
# Forward * abbrs |
13 |
line = re.sub(r'(/)(\w+)(?=\w*(?:->/[^/]*)?/\2\b)', r'\1*', line) |
|
13 |
line = re.sub(r'(?i)(/)(\w+)(?=\w*(?:->/[^/]*)?/\2\b)', r'\1*', line)
|
|
14 | 14 |
# Backward * abbrs |
15 |
line = re.sub(r'(/(\w+)->/[^/]*/[^/]*\[)\2', r'\1*', line) |
|
15 |
line = re.sub(r'(?i)(/(\w+)->/[^/]*/[^/]*\[)\2', r'\1*', line)
|
|
16 | 16 |
sys.stdout.write(line) |
17 | 17 |
|
18 | 18 |
main() |
Also available in: Unified diff
simplify_xpath: Made it case-insensitive