Reputation: 589
I would like to create a pattern, which matches all ASCii decimal codes from 58 to 64 (include 58 and 64)
String regExp=""; //ASCii decimal codes 58 - 64
//How to define above regular expression string "regExp"
Pattern pattern = Pattern.compile(regExp);
How to define the regular expression string regExp
?
Upvotes: 1
Views: 297
Reputation: 9856
Here is with raw ASCII numeric values.
String regExp = "[\\x3A-\\x40]+";
Should match all occurrences.
Upvotes: 2
Reputation: 272307
If you want to use numeric values, try
String regexp = "[\\x3a-\\x40]";
You can't specify decimal values, unfortunately. See the Pattern doc for more info.
Upvotes: 3