Regular expression to validate text

2

I'm doing a method that will import some data, and before importing I need to check if some fields are correctly filled in, the fields should come this way:

Example:

Jan/Seg
Fev/Ter
Mar/Qui

The data must be in this exact format, where the first 3 characters represent the month prefix, followed by a slash and then 3 characters representing the day of the week.

I need to check if the month prefix is valid and if the week prefix also, and needs to contain both, I thought of making a regex that does this, however I do not know how to do in C# , someone knows a good way to do that? Thank you in advance.

    
asked by anonymous 21.11.2018 / 13:33

1 answer

3

I do not know how it's done in C #, but Regular Expression might look like this:

^(Jan|Fev|Mar|Abr|Mai|Jun|Jul|Aug|Set|Out|Nov|Dez)\/(Seg|Ter|Qua|Qui|Sex|Sab|Dom)$

that she will be able to validate for you

    
21.11.2018 / 13:41