regexvalidationfilepattern

Regex with a wildcard text string


I have 2 file patterns

I was hoping to use the 1 regex but i'm having difficulty with anything after the first underscore

This is what i thought would work

VCS([a-zA-Z]*$)_[0-9]{8}_OMEGA.csv

Please help


Solution

  • A complete regex that matches what you're looking for and nothing but:

    \AVCS(Trades|Positions)_[0-9]{8}_OMEGA\.csv\Z

    If this pattern will occur within a line of text, remove the \A and \Z from the beginning and end, respectively.

    Also, if you want to test out regexes, I recommend a website like Rubular - it tests your regex in real-time against any text you put in the box.