Regular Expressions 101

Community Patterns

Match Microchip xc16 library's PIC24 and dsPIC3x linker script filenames


Regular Expression

'^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$


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 - 3 years ago