I have this regex pattern:
[^-]+-(.+)[^\d](.+)-(.*?)-.*(\d+).*-([\w]+-[\w]+-[^-]+)-(\d+-\d+)-(.+)\.
That needs to match both these cases
Data Location 1 - many many words 201808206566 - many words - 010114-INL-USD-B087834-2018-08-Bill.PDF
Data Location 1 - many many words 201808206565 - many words - 010115-INL-B087845-2018-08-Bill.PDF
As is, this matches the first case and not the second. And I get the opposite result by removing one instance of [\w]+-
from within the 5th capture group, this is because the first case contains INL-USD-B087834, which has an additional data block in it. How can I make the second instance optional?