Skip to content

Make skip pattern into a subroutine #2

Open
@laowantong

Description

@laowantong

For instance, the construct index:

          ^(.*?)/_type='Subscript'
\n(?:\1.+\n)*?\1/lineno=(?P<LINE>\d+)
\n(?:\1.+\n)*?\1/slice/_type='Index'

... could be expressed as:

^(.*?)/_type='Subscript'
      (?(DEFINE)(?P<sq>\n(?:\1.+\n)*\1))
(?&sq)/lineno=(?P<LINE>\d+)
(?&sq)/slice/_type='Index'

To further mute the regex noise, the definition could be injected dynamically after the first closing parens.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions