is Letter Or Number by regex - Android java.util.regex

Android examples for java.util.regex:Phone Number Pattern

Description

is Letter Or Number by regex

Demo Code


//package com.java2s;

import java.util.regex.Pattern;

public class Main {
    public static boolean isLetterOrNum(String str) {
        String regex = "^[a-z0-9A-Z]+$";
        Pattern pattern = Pattern.compile(regex);
        return pattern.matcher(str).matches();
    }//from www  .  j  av a  2  s  .  co m
}

Related Tutorials