Regular Expressions 101

Community Patterns

1...45678...902

Community Library Entry

0

Regular Expression
Python

r"
'^p( ( ( (24 ( (ep) | (f[jv]?) | (hj) ) ) (\d{1,4}) [a-z]{2} \d{3} ([a-z]?))) | 30f \d{4} [a-z]?| 33( ( c [hk] \d{1,4} m[cp] \d{3} (s1)? ) | ( e (p|dv?|v) \d{2,3} [a-z]{2} \d{2,4} ) | (fj \d{1,4} (mc|g[sp]) \d{3} a?)) ) \.gld$
"
gmix

Description

Created for a Python program that needed to help recognize linker script filenames that resemble those for actual devices in Microchip's 16-bit DSC/MCU family of chips.

The regex will match any such filename found in Microchip's xc16 support directory tree, as of xc16 v1.50. (I've actually tested it on all of them).

It will also match filenames that don't correspond to anything supplied by Microchip in xc16 v1.50. But it's still useful to help spot filenames that are very dissimilar to the ones Microchip provides.

Submitted by Galen Tackett - 4 years ago