I believe this will do what you ask, where if the option '_nnn' is present then the extension should be '.ilf', or if it is ' nnn' then the extension should be '.sht'; whilst capturing the entire optional part to $1 and the last digit of that optional part to $2:
Update: tightened slightly. Update2: Tightening removed; unnecessary.
m[ ^ \d{8} ( (?(?=.* \. ilf) _ | \s | (?!) ) ) (\d)+ )* \. (?:ilf| +sht) ]x
Whether you would call that a 'shortcut' is debatable.
In reply to Re: File name regex
by BrowserUk
in thread File name regex
by dev2dev
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |