Rajesh Biswas
Rajesh Biswas

Reputation: 31

Convert XSD Regex into Java Regex

I want to convert the below XSD regular expression into equivalent Java regex

XSD Regex is ([\p{L}\p{Nd}\p{Z}\p{P}]){1,255}

Would you please suggest

Upvotes: 0

Views: 318

Answers (1)

Mike Clark
Mike Clark

Reputation: 10136

Double up the backslashes to embed the regex in a Java string

String regexStr = "([\\p{L}\\p{Nd}\\p{Z}\\p{P}]){1,255}";
Pattern regex = Pattern.compile(regexStr);

Upvotes: 1

Related Questions