NOT SIIT.NET webboard / read message
This is it.

topic id 40510 | forum IT | read 1057 | answer 6
3
1. keyword => {[A-Za-z0-9]+} ͧ { } 1 ѹҹ 繤ѹ¹
2. number => [0-9]
3. operator => + - * /

*abc

ҧ Ẻ١..
100
{keyword0}
{keyword1}+200
300-{keyword2}
{keyword3}+{keyword4}
400*500

ẺԴ
{keyword0
keyword1}
{keyword2}+
100+
+{keyword3}
+200
{keyword4+200
keyword5}+300

ẺѺ java.lang.String method matches ..
Mon, 11 Jun 2007 15:30:25 -   

[1] public static void main(String[] args) {
// TODO Auto-generated method stub
String[] s1 = {"100", /* true from here */
"{keyword0}",
"{keyword1}+200",
"300-{keyword2}",
"{keyword3}+{keyword4}",
"400*500",
"{keyword0", /* must be false from here */
"keyword1}",
"{keyword2}+",
"100+",
"+{keyword3}",
"+200",
"{keyword4+200",
"keyword5}+300"};


for (int i=0;i+" : "+reg_check(s1));
}

private static boolean reg_check(String str){
return str.matches("\{\w+\}(\+|-|\*|/)\{\w+\}"); \ç.. ˹..
}
Mon, 11 Jun 2007 15:53:25 -   

[2] ѹ 0_o"
Mon, 11 Jun 2007 22:44:12 -   Cyber Man

[3] ǹ

繤ѹ ֡ѹԹ expressive power ͧ regex ǹ
Mon, 11 Jun 2007 22:44:49 -   bact'

[4] ({([A-Za-z0-9]+)}|d+)((([*+-])({([A-Za-z0-9]+)}|d+))?)*

^ $ Ƿ´¹
{} java escape Ǽ㨹 tool ѹ仵ç java escape ͧ
Tue, 12 Jun 2007 15:50:03 -   T_N

[5] ç operator ͧ Ҵ
Tue, 12 Jun 2007 15:52:52 -   T_N

[6] ..ͺسҺ..


͹á֡ҧ.. ˹͹ѹ
Tue, 19 Jun 2007 11:40:15 -   

Please login to reply.


Click here to login.

 digiboard 0.42 by digitalboom.org since 2001, NOT.SIIT.NET