Huh, ... confusing.
Lemme see if I can explain it a better way.
I have a bunch of job numbers in a directory.
...
06112
06113 -Horizon
06113.A -Horizon Addition
06113.A2 -Horizon Addition Revised
...
I need to match 06113.A2 with 06113.A2 without knowing whether or not it has a name after it and without knowing if it is 5 digits, 6 digits, 7 digits, or 8.
(setq CurrentFilePath (getvar "dwgprefix")) ; returns X:\Drawings 2006\06113.A2 -Horizon Addition Revised\\
(setq CFJobNmbr (substr CurrentFilePath 18)) ; returns 06113.A2 -Horizon Addition Revised\\
(setq CFJobNmbr (substr CFJobNmbr 1 8)) ; returns 06113.A2
... Now it gets tricky
If I am currently in 06113
(setq CurrentFilePath (getvar "dwgprefix")) ; returns X:\Drawings 2006\06113 -Horizon\\
(setq CFJobNmbr (substr CurrentFilePath 18)) ; returns 06113 -Horizon\\
(setq CFJobNmbr (substr CFJobNmbr 1 8)) ; returns 06113 -H
If CFJobNmbr is 8 characters (06113.A2), then
(setq FilePathEnding CFJobNmbr)
If the job number is 06113, then I need only the 5 characters. Otherwise I get 06113 -H for my return.
So my question is;
How can I extract the job number from the dwgprefix without the name after the job number & determine if I need 5 characters or 6, or 7, or 8 ??
I was looking at wcmatch, but I'm not sure how I would put that together to make it work yet. Do you have any other suggestions ??
Thank you for your advice in advance,