mirror of
https://github.com/Garmelon/PFERD.git
synced 2026-04-12 23:45:05 +02:00
Support named capture groups in regex transformers
This commit is contained in:
parent
19beb8f07b
commit
d0340bd0f8
1 changed files with 4 additions and 0 deletions
|
|
@ -110,6 +110,10 @@ class ExactReTf(Transformation):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
named_groups: Dict[str, str] = match.groupdict()
|
||||||
|
for name, capture in named_groups.items():
|
||||||
|
locals_dir[name] = capture
|
||||||
|
|
||||||
result = eval(f"f{right!r}", {}, locals_dir)
|
result = eval(f"f{right!r}", {}, locals_dir)
|
||||||
return Transformed(PurePath(result))
|
return Transformed(PurePath(result))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue