How to prevent a regex filter from catching a valid file name

How to prevent regex to catch this file name:

"Metview Turbine Tool Record_08.01.2018_monitor.pdf"

This is the regex filter that is catching that file:

GSIS\\.dat|RCM_V_.*\\..*|GMWOD-.*|RMQS.*\\..*|O.*\\.[0-9]{3}|.*\\.SPS|PLAN.*\\.XML|.*LICENSE\\.MLF|ITSYSE.*\\..*|ITSYSW.*\\..*|MSPSALV.*\\..*|MSPSV.*\\.DAT|VESI.*|VESU.*|WCR.*\\.DAT|TRF_SPLIT.*

Open in new window


It seems the dots in the PDFs date is triggering the regex filter. Removing the dots in the date "Metview Turbine Tool Record_08012018_monitor.pdf"
MontyAsked:
Who is Participating?
 
Rgonzo1971Commented:
Hi,

pls try
\\b(GSIS\\.dat|RCM_V_.*\\..*|GMWOD-.*|RMQS.*\\..*|O.*\\.[0-9]{3}|.*\\.SPS|PLAN.*\\.XML|.*LICENSE\\.MLF|ITSYSE.*\\..*|ITSYSW.*\\..*|MSPSALV.*\\..*|MSPSV.*\\.DAT|VESI.*|VESU.*|WCR.*\\.DAT|TRF_SPLIT.*)\\b

Open in new window

REgards
0
 
David Johnson, CD, MVPOwnerCommented:
you have to define an invalid filename and work with that as a base
0
 
MontyAuthor Commented:
Hi Rgonzo1971, can you please explain the logic?
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
ozoCommented:
O.*\\.[0-9]{3}  can match "ol Record_08.01.201", assuming case insensitive matching is used
\\bO will prevent a match between "oo" or between "To" or between "co"
[0-9]{3}\b will prevent a match between "18"
0
 
MontyAuthor Commented:
Thank you but Rgonzo1971 placed the \b flag only at the beginning of the regex expression.

\\b(GSIS\\.dat...
0
 
ozoCommented:
The rest of the regular expression is grouped in ( )

So the \b could also potentially prevent other matches if you wanted any of the other alternatives to match in the middle of words.
0
 
MontyAuthor Commented:
Hi Ozo and all

I used https://www.regextester.com/ to test and it does not match it.
0
 
MontyAuthor Commented:
Hi David, could you please explain... this >> "you have to define an invalid filename and work with that as a base"
0
 
Rgonzo1971Commented:
You say it does not match but your question is how to to prevent a match?
0
 
MontyAuthor Commented:
Thank you!
0
 
MontyAuthor Commented:
Hello! I meant to give credit to @OZO as well. How can I do this the question is closed.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.