Guest User

Untitled

a guest
Jun 22nd, 2012
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. validate string with regex on android
  2. private static boolean IsMatch(String s, String pattern) {
  3. try {
  4. Pattern patt = Pattern.compile(pattern);
  5. Matcher matcher = patt.matcher(s);
  6. return matcher.matches();
  7. } catch (RuntimeException e) {
  8. return false;
  9. }
  10. }
  11.  
  12.  
  13.  
  14. String regex ="[^*;$]";
  15. System.out.println(IsMatch(url,regex));
Advertisement
Add Comment
Please, Sign In to add comment