java匹配表达式怎么写 ? 求教~~ String s="=a.aaaa =abc =123 =b.bbbb";//想输出 abc 123匹配表达式怎么写 ? 求教~~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 String s="=a.a23a =abc =123 =b.babb";恩 没有点 的字符串 返回 abc 123 这样 public static void main(String[] args) { String s="=a.a23a =abc =123 =b.babb"; Matcher m = Pattern.compile("(?<=\\=)[^\\.]+?(?=[ $])").matcher(s); while(m.find()){ System.out.println(m.group()); } } //修改一下:String s="=aaa =a.a23a =abc =123 =b.babb =ccc";Matcher m = Pattern.compile("(?<=\\=)[^\\.]+?(?=($|\\s))").matcher(s); package com;import java.util.regex.*;public class RegexDemo { public static void main(String[] args) { String s="=a.aaaa =abc =123 =b.bbbb"; Pattern p = Pattern.compile("=([\\w]{3})"); Matcher m = p.matcher(s); while(m.find()){ System.out.println(m.group(1)); } }} System.out.println(s.substring(s.lastIndexOf('a'),s.indexOf('c')+1)+"\n"+s.substring(s.indexOf('1'),s.indexOf('3')+1)); import java.util.regex.*;public class RegexDemo { public static void main(String[] args) { String s="=a.aaaa =abc =123 =b.bbbb"; Pattern p = Pattern.compile("\\=[^\\.]+\\s"); Matcher m = p.matcher(s); while(m.find()){ System.out.println(m.group(1)); } }} String s="=a.aaaa =abc =123 =b.bbbb =d1d"; 这样的话 最后字段d1d取不出 新手疑问。关于封装的思想动态数组arraylist 大量java问题质询 快速排序如何实现? java虚拟机的作用? 请问 求数组的长度的时候为什么会有错误? 人在线 有答案马上结贴 一道笔试题,选哪个,为什么? 求解歌德巴赫猜想 哎!郁闷,HelloWorldApp的问题!(online waiting) jdbc问题,谁帮解决,满分相送。 我要是问JAVA是做什么用的,那就太。。。。。那个什么了吧。 它和VC++的区别是什么呀? 鼠标点击button时间的问题 synchronized标记 和synchronized 方法有什么区别
public static void main(String[] args) {
String s="=a.a23a =abc =123 =b.babb";
Matcher m = Pattern.compile("(?<=\\=)[^\\.]+?(?=[ $])").matcher(s);
while(m.find()){
System.out.println(m.group());
}
}
//修改一下:
String s="=aaa =a.a23a =abc =123 =b.babb =ccc";
Matcher m = Pattern.compile("(?<=\\=)[^\\.]+?(?=($|\\s))").matcher(s);
package com;import java.util.regex.*;public class RegexDemo {
public static void main(String[] args) {
String s="=a.aaaa =abc =123 =b.bbbb";
Pattern p = Pattern.compile("=([\\w]{3})");
Matcher m = p.matcher(s);
while(m.find()){
System.out.println(m.group(1));
}
}
}
import java.util.regex.*;public class RegexDemo {
public static void main(String[] args) {
String s="=a.aaaa =abc =123 =b.bbbb";
Pattern p = Pattern.compile("\\=[^\\.]+\\s");
Matcher m = p.matcher(s);
while(m.find()){
System.out.println(m.group(1));
}
}
}
String s="=a.aaaa =abc =123 =b.bbbb =d1d"; 这样的话 最后字段d1d取不出