Skip to content
Advertisement

Regex match any of the words separated by slashes

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:

JavaScript

Incorrect:

JavaScript

Advertisement

Answer

You may use this regex:

JavaScript

RegEx Demo

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement