常用正则表达式
js
var pattern = //;
var str = "";
console.log(pattern.test(str));
java
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegexMatches {
public static void main(String args []) {
String str = "";
String pattern = "";
Pattern r = Pattern.compile(pattern);
Matcher m = r.matcher(str);
System.out.println(m.matches());
}
}
python
import re
pattern = re.compile(ur'')
str = u''
print(pattern.search(str))
php
$str = "";
$isMatched = preg_match('//', $str, $matches);
var_dump($isMatched, $matches);
go
package main
import (
"fmt"
"regexp"
)
func main() {
str := ""
matched, err := regexp.MatchString("", str)
fmt.Println(matched, err)
}
ruby
pattern = //
str = ''
p pattern.match(str)