I need to validate the name of a file that has the following name NWD[0-9] PADRAO -
. The literal part will always be the same, what can vary are the numbers.
I would like to know how to do this with Regex .
I need to validate the name of a file that has the following name NWD[0-9] PADRAO -
. The literal part will always be the same, what can vary are the numbers.
I would like to know how to do this with Regex .
Regex is almost the one that you put in the question, but adding the "+" operator that indicates "one or more occurrences of the list". Example:
/ NWD [0-9] + PATTERN - /
The Regex that will solve your problem is:
(NWD+[0-9]*)( PADRAO \-)
This means that you will always search for NWD
followed by 0 a 9 um número qualquer de vezes
characters and lastly search for "espaço" PADRAO "espaco" -
This working regex can be checked here .