Reputation: 109
How to validate a filename with a extension '.pdf' and it should not have a '+' or '%' sign in its name? The regex to check for the 'pdf' extension is /(\.|\/)(pdf)$/i,
. How to combine these validations?
Upvotes: 1
Views: 1612
Reputation: 92854
Use the following regex pattern:
^[^+]+\.pdf$
^
- start of the string
[^+]+
- one or many characters except +
https://regex101.com/r/MZhqSL/4
Upvotes: 2