import java.io.*;
import java.util.regex.*;
public class test1
{
public static void main(String[] args)
{
String str = "b龙";
String regex="\b\w";
Matcher m=Pattern.compile(regex).matcher(str);
if(m.find()){
System.out.println(m.group());
}
}
}
为什么提示\w是非法转义符?不是说他可以代表任意的字母汉字数字或下划线吗
import java.util.regex.*;
public class test1
{
public static void main(String[] args)
{
String str = "b龙";
String regex="\b\w";
Matcher m=Pattern.compile(regex).matcher(str);
if(m.find()){
System.out.println(m.group());
}
}
}
为什么提示\w是非法转义符?不是说他可以代表任意的字母汉字数字或下划线吗
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货