J
J
Jekson2020-05-07 10:51:20
Regular Expressions
Jekson, 2020-05-07 10:51:20

Make regex minimal for filename?

Please help write a regex to validate a filename with this pattern:

SM_YYYYQ#_{Vendor_Name}_{RFI_Round}_{version}.xslx
SM_YYYYQ#_{Vendor_Name}_{RFI_Round}_{version}.xsl


Name example
SM_2020Q1_Vendor_20R1_1.xls

SM-always constant
YYYYQ# is year + quarter. Q# can take the values ​​(Q1-Q4)
Vendor_Name - anything, just the name
RFI_Round - a combination of two digits-letter latin-digit . Example 20R1
version - one digit

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Pankov, 2020-05-07
@Lepilov

^SM_\d{4}Q\d_.*?_\d\d[A-Z]\d_\d\.xls$
https://regex101.com/r/9711ng/1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question