Heh. I have C# and Perl regex examples available, and robject has a published Perl library including regex parsers.
There are really only two tricky bits to parsing UWPs with regex: distinguishing name from hex and codes from bases/zones, since you have to assume some minimal length for fields. I don't have the code in front of me, but I believe I use something like:
^(.{15,}) +(\d\d\d\d) +(\w\w\w\w\w\w\w-\w) +(\w| ) +(.{15,}) +(\w| ) +([0-9][0-9A-F][0-9A-F]) +(\w\w)
In English, this translates to:
* Capture name (at least 15 characters)
* Capture hex (4 digits)
* Capture UWP (XXXXXXX-X)
* Capture base (single character, may be blank)
* Capture codes (at least 15 characters)
* Capture zone (single character, may be blank)
* Capture PBG (3 "hex" digits)
* Capture allegiance (2 characters)
Anything after that is either stellar data or an extension, which I ignore. You have to do whitespace trimming on various fields and handle special cases (like . as a name terminator in some T4-era files; some un-named worlds have the hex name as their name so you can blank that out)
This handles about 99% of the lines in random SEC files, but that 1% is pretty big, with fun things like:
* I l and O in place of digits, especially in PBG
* Space instead of - in the UWP
* Missing PBG altogether
* Extra fields proposed at various times
* Funky allegiances (e.g. "JP/Jm")
See
http://travellermap.blogspot.com/search/label/bug fixes for the trials and tribulations