Neighborhoods a regular expression written, Come.

Category: Java SE
 
subastro
2010-02-27 11:45:23

Sponsored Links
Match: xxx not match xxxabc, and, in the multi-line String inside to do, that is not necessarily xxx and xxxabc end of the line.

Sponsored Links

xtyta2009
2010-02-27 11:57:27
Their top! Points to 50! ! !
weifang911
2010-02-27 12:00:21

"\ \ bxxx \ \ b"
BRUCE_ECURB
2010-02-27 12:19:49
". * xxx. +"
dolia588
2010-02-27 12:28:56
I was not clear, my meaning there is a need to find those xxx, xxx behind and can not have abc.
so "\ \ bxxx \ \ b" is not what I want, it does not match xxxdef this xxx.
while, ". * xxx. +" is not what I want, it does not guarantee is not behind abc.
ocean317918
2010-02-27 12:34:39
xxx [^ abc] matches besides xxxa, xxxb, xxxc outside xxx
xxx ^ abc matches besides xxxabc outside xxx

this reply reference jdk1 .4.1 the java.util.regex.Pattern class-help, if there is not clear, see the help
liuzhihong0815
2010-02-27 12:46:18
lhj (to refuel), say what ah? You tried it? Did not help me to see, read N times ~

System.out.println ("abcfed". Matches ("abc ^ fed"));
System.out.println ("abcdef". matches ("abc ^ fed"));

result is false, I do not know.
www256
2010-02-27 01:06:14
Oh, it is a problem, I wrote code to test:
import java.util.regex. *;

public class test_regex {
public test_regex () {
}
public boolean test_match (String str, String regStr) {
System.out.println ("parameter:" + str + "" + regStr);
; Pattern p = Pattern.compile (regStr);
Matcher m = p.matcher (str);
; return m.matches ();
}
public static void main (String [] args) {
test_regex test_regex1 = new test_regex ();
String regStr;
; regStr = ". * xxx [^ abc]. *";
System.out.println (test_regex1.test_match ("jxxxabcjjj", regStr)) ;
System.out.println (test_regex1.test_match ("jxxxfffdjj", regStr));
System.out.println ( test_regex1.test_match ("hxxxadddjj", regStr));
System.out.println (test_regex1.test_match ("gxxxbeeejj", regStr));

regStr = ". * xxx. [] *";
System.out.println (test_regex1.test_match (" ; jxxxabcjjj ", regStr));
System.out.println (test_regex1.test_match (" jxxxfffdjj ", regStr));
; System.out.println (test_regex1.test_match ("hxxxadddjj", regStr));
System.out.println (test_regex1.test_match ("gxxxbeeejj", regStr)) ;
}

}
mailonfei
2010-02-27 01:09:29
problem is to match the complete abc where, no test is successful
tct987
2010-02-27 01:12:49
. * You have to add their own ah
szbt612
2010-02-27 01:30:04
in jellyfish did not get it on, it turned out to be stumped by this question the national programmer ~
dragongodsgod
2010-02-27 01:40:22
Top about! assigned 100 plus, solve problems, immediately get points.
cenxiaopang
2010-02-27 01:53:04
not, oh, I have to get
regStr = ". * xxx [~ (abc)]. *";
tested

import java.util.regex. *;

public class test_regex {
public test_regex () {
}
public boolean test_match (String str, String regStr) {
System.out.println ("parameter: "+ str +" "+ regStr);
Pattern p = Pattern.compile (regStr);
Matcher m = p.matcher (str);
return m.matches ();
;}
public static void main (String [] args) {
test_regex test_regex1 = new test_regex ();
String regStr;
regStr = ". * xxx [^ abc]. *";
System.out.println (test_regex1.test_match ("jxxxabcjjj", regStr));
System.out.println (test_regex1 . test_match ("jxxxfffdjj", regStr));
System.out.println (test_regex1.test_match ("hxxxadddjj", regStr));
; System.out.println (test_regex1.test_match ("gxxxbeeejj", regStr));

regStr = ". * xxx [~ (abc)]. * ";
System.out.println (test_regex1.test_match (" jxxxabcjjj ", regStr));
System.out.println (test_regex1.test_match ("jxxxfffdjj", regStr));
System.out.println (test_regex1.test_match ("hxxxadddjj", regStr));
System.out.println (test_regex1.test_match ("gxxxbeeejj", regStr));
}

}
wangtai706
2010-02-27 02:07:28
is because the continuous recovery of the last three times, the test can not continue after being replied. Landlord is not really give 100 points ah, ha ha
woshiak47
2010-02-27 02:14:26
Upstairs brothers, you're too much.

jdk documentation I have seen, there seems never mentioned - this symbol usage.

can introduce some of this information to see?

Thank you first.
Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.