用户名

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexMatches {

public static void main(String args[]) {
String str = “”;
String pattern = “[A-Za-z0-9_-u4e00-u9fa5]+”;

Pattern r = Pattern.compile(pattern);
Matcher m = r.matcher(str);
System.out.println(m.matches());
}

}

package main

import (
“fmt”
“regexp”
)

func main() {
str := “”
matched, err := regexp.MatchString(“[A-Za-z0-9_-u4e00-u9fa5]+”, str)
fmt.Println(matched, err)
}

import re
pattern = re.compile(ur'[A-Za-z0-9_-u4e00-u9fa5]+’)
str = u”
print(pattern.search(str))

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s