I need to develop a validation pattern for catching any kind from:
pdf/csv/xlsx
select any separate word is simple:
(pdf|csv|xlsx).
However, I need to check that any combination with them separated by slash is fine as well.
For example, correct flow:
pdf/csv/xlsx pdf pdf/csv csv/xlsx xlsx pdf/xlsx
Incorrect:
test incorrect doc
Advertisement
Answer
You may use this regex:
^(?:pdf|csv|xlsx?)(?:/(?:pdf|csv|xlsx?))*$