正则表达式测试工具/常用正则表达式/正则代码生成
代码生成结果:

java

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

public class RegexMatches {
	public static void main(String args[]) {
		String str = "";
		String pattern = "[\\u4e00-\\u9fa5]";

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

}

js

var pattern = /[\u4e00-\u9fa5]/,
str = '';
console.log(pattern.test(str));

php

$str = '';
$isMatched = preg_match('/[\u4e00-\u9fa5]/', $str, $matches);
var_dump($isMatched, $matches);

go

package main
import (
	"fmt"
	"regexp"
)

func main() {
	str := "test"
	matched, err := regexp.MatchString("[\\u4e00-\\u9fa5]", str)
	fmt.Println(matched, err)
}

rb

pattern = /[\u4e00-\u9fa5]/
str = ''
p pattern.match(str)

python2

import re
pattern = re.compile(ur'[\u4e00-\u9fa5]')
str = u''
print pattern.search(str)

python3

import repattern = re.compile(ur'[\u4e00-\u9fa5]')
str = ''
print pattern.search(str)

objc

NSString *str = @"";
NSString *pattern = @"[\\u4e00-\\u9fa5]";
NSError *error = NULL;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern: pattern options: nil error: &error];
NSArray *match = [regex matchesInString: str options: NSMatchingCompleted range: NSMakeRange(0, [str length])];
if (match.count != 0) {
// ...