Regular Expressions 101

Community Patterns

Match the names of C RTL startup modules from Microchip's XC16 compiler RTS library liblega-pic30-(elf|coff).a

0

Regular Expression
Python

r"
(?x)^(?P<crt>crt) (?: (?: (?:_) (?P<sm>start_mode)(?P<ul>_)?(?P<smq>(?(ul)normal|ep)) | (?: (?P<bool>[01])\B (?:_ (?: (?: (?P<dual>dual(?P<dq>ch)) | (?P<ext>extended)(?P<q>ch|da|ep) | (?P<std>standard) | (?P<bstr>\w*)) ) | ) | (?: (?: (?P<digit>[2-9])(?:_)(?P<str>\w*))) ) ) )$
"
gm

Description

Matches the names of all the C startup modules found in the library. Should also match similarly-named modules.

Minimizing capture groups and clarifying(?) capture group names

A work in progress!

Submitted by anonymous - 3 years ago