I have these below file names and using below regex to match:
File Names:
- 1234 12345678 TEST DOCUMENT December 20, 2018.pdf
- 1234 12345678 TESTDOCUMENT December 20, 2018.pdf
Regex I am using to match the file name is:
(\d+)\s(\d+)\s(\w+\s?\w+)
for the first file it is working, but for the 2nd file it is matching month December also as these are two words with a space too.
How to write a regex to match only upto "1234 12345678 TEST DOCUMENT" in both cases with or with out space between TEST and DOCUMENT.
Expected Result:
- 1234 12345678 TEST DOCUMENT
- 1234 12345678 TESTDOCUMENT
Not this for 2nd file(1234 12345678 TESTDOCUMENT December)