I want a function to search a string to see if it contains $[0-9] or $[af,AF]
So like, if it contains $a or even $e it'll turn true.
Check out the Java docs, very straightforward:
The regex is /\\$[A-Fa-f0-9]/
and you might use it like so:
Pattern.matches("\$[A-Fa-f0-9]", yourString);
See http://download.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html
create regex with the help of this tutorial : http://download.oracle.com/javase/tutorial/essential/regex/matcher.html
use matches() method from String class : http://download.oracle.com/javase/7/docs/api/java/lang/String.html#matches%28java.lang.String%29
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.