Detecting filename via regex, trouble with auto-detect


Author
Message
strat68
strat68
Junior Member (64 reputation)Junior Member (64 reputation)Junior Member (64 reputation)Junior Member (64 reputation)Junior Member (64 reputation)Junior Member (64 reputation)Junior Member (64 reputation)Junior Member (64 reputation)Junior Member (64 reputation)
Group: Forum Members
Posts: 5, Visits: 41
Hi, this is a question regarding regex in detecting a file name pattern (not parsing of the contents).

In the app I work with we have logfiles with a simple format filename.log, then we have rollovers based on policy (size/age) that look like:  filename.log.2020-12-19.1 (last digit increments: 2,3,...999).  Obviously, the other digits are YYYY-MM-DD.

Using the website regex101 dot com, I created and tested my regex for the above rollover and it works correctly:
^[a-z].*\.log\.[0-9]{4}\-[0-9]{2}\-[0-9]{2}\.[0-9]{1,3}$

I don't believe ^ and $ are needed for a filename (maybe if it contains spaces??) but I tried with and without, and same result.  Auto-detect does not pickup the pattern in my parser mappings, and it goes to basic parser.  I know the workaround of going to "Parse With" but just curious, is it some kind of versioning with Regex?  Or does LVP use a subset of regex? 

Also, my parser args for the file content are, of course, the same for current log or the rollover. Would I be better off keeping one mapping and using a logical OR.  e.g  ( patternA | patternB)?

Feedback appreciated, thanks!
Edited 5 Years Ago by strat68
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Login

Explore
Messages
Mentions
Search