Control Sketch Text from Filename

In our company, as with many, parts are identified with fairly uniform part numbers. Ours contain certain machine specs and a revision level expressed in the form of something like "020O3-25-D1". D1 here is the revision level.
What I would like to do is etch my parts with the revision level. Straightforward enough to do manually with sketch text and cut extrude, yes, but there should be a way to link the sketch's text with the filename, such that the sketch will look at the filename, parse the revision level (with a regular expression or string function), and use that string to drive the sketch text. This way, when I pack&go to create a new revision, the part etchings will all be automatically updated.
I think the solution would involve custom properties, maybe macros, but I'm not overly familiar with this functionality in Solidworks. Does anyone know how you'd go about this?