Vijay
Vijay

Reputation: 1

RegEx for Unicode strings to check the string does not contain specific characters

Basically, I need to check that a utf-16 string does not contain these characters /:*?<>|+. Apart from them, it can contain any character from English to Latin.

For normal ASCII strings, we would write a RegEx something like ^[^\/:?<>|+]$ How does this expression change for UTF-16 formatted strings?

Can we represent this expression using ascii characters in the RegEx? Or should we have there equivalent unicode code points for matching any characters?

Upvotes: 0

Views: 1045

Answers (1)

Ωmega
Ωmega

Reputation: 43673

As all of your special character that you don't want to allow are normal ASCII characters, use regex pattern

/^[^\/:*?<>|+]*$/

Upvotes: 1

Related Questions