一个在Flash里面使用的正则表达式的类(4)
2008-04-02 11:03:26来源:互联网 阅读 ()
cs=0;
while(cs<=cl&&substring(c,1 cs ,1)!=ct){
}
if(cs<=cl){
break;
}else{
m ;
ix ;
}
}
}
}elseif(q[i].t==10){
//Endofstring/linemustbenext
s=substring(str,1 ix,1);
m=(this.multiline&&(s=="\\\\\\\\\\\\\\\\n"||s=="\\\\\\\\\\\\\\\\r"))||ix==l?1:0;
}elseif(q[i].t==3){
//Regularexpressioninparens
re=q[i].s;
q[i].ix=[];
q[i].ix[m]=ix;
//Saveindexifneedtoretreat
re.lastIndex=ix;
while(m<q[i].b&&re.test(str_)){
cl=length(RegExp._xxlm);
if(cl>0){
ix =cl;
m ;
q[i].ix[m]=ix;
}else{
m=q[i].a;
q[i].ix[m-1]=ix;
break;
}
}
if(m==0){
RegExp._xxlm="";
}
if(re._xr>RegExp._xxlp){
RegExp._xxlp=re._xr;
}
RegExp._xxa[Number(re._xr)]=RegExp._xxlm;
}elseif(q[i].t==4){
//Backreferencetoparen
if(RegExp._xp>=(c=Number(q[i].s))){
c=RegExp._xxa[c];
c=this.ignoreCase?c.toLowerCase():c;
cl=length(c);
q[i].ix=[];
q[i].ix[m]=ix;
if(cl>0){
while(m<q[i].b&&ix<l){
if(substring(str,1 ix,cl)==c){
m ;
ix =cl;
q[i].ix[m]=ix;
}else{
break;
}
}
}else{
m=0;
q[i].a=0;
}
}else{
//Parenisnotready,treatnumberascharcode
c=chr(c);
q[i].ix=[];
q[i].ix[m]=ix;
while(m<q[i].b&&ix<l){
if(substring(str,1 ix,1)==c){
m ;
ix ;
q[i].ix[m]=ix;
}else{
break;
}
}
}
}
q[i].c=m;
if(RegExp.d){
trace("" m "matchesfound");
}
}
if(q[i].c<q[i].a){
if(RegExp.d){
trace("notenoughmatches");
}
//Notenoughmatches
if(i>qb){
//Retreatbackanddecrease#ofassumedmatches
i--;
q[i].c--;
if(q[i].c>=0){
ix=(q[i].t==3||q[i].t==4)?q[i].ix[q[i].c]:(q[i].i q[i].c);
}
if(RegExp.d){
trace("Retreatto#" i "c=" q[i].c "index=" ix);
}
}else{
if(RegExp._xp>1){
//Ifthisisaparen,failingtofindfirstmatchisfatal
break;
}
if(atStart){
//Matchmustbeatthestartofstring/line
if(this.multiline){
//Jumptothebeginningofthenextline
while(ix<=l){
s=substring(str,1 ix ,1);
if(s=="\\\\\\\\\\\\\\\\n"||s=="\\\\\\\\\\\\\\\\r"){
break;
}
}
q[i].c=-10;
}else{
//Nomatch
break;
}
}else{
//Startanewsearchfromnextposition
ix ;
q[i].c=-10;
}
}
}else{
if(RegExp.d){
trace("enoughmatches!");
}
//#ofmatchesok,proceedtonext
i ;
if(i==qc||q[i].t==7){
if(RegExp.d){
trace("Savingbetterresult:r.i=q[" qb "].i=" q[qb].i);
}
r.i=q[qb].i;
r.li=ix;
break;
}else{
q[i].c=-10;
}
}
}
}
while(i<qc&&q[i].t!=7){
i ;
}
//Jumptothenext"OR"section
}
if(r.i<0){
this.lastIndex=0;
if(RegExp._xp--==1){
RegExp._xxa=[];
RegExp._xxlp=0;
}
returnfalse;
}else{
ix=r.li;
this._xi=r.i;
RegExp._xxlm=substring(str_,r.i 1,ix-r.i);
RegExp._xxlc=substring(str_,1,r.i);
RegExp._xxrc=substring(str_,ix 1,l-ix);
if(ix==r.i){
ix ;
}
this.lastIndex=ix;
if(RegExp._xp--==1){
RegExp.lastMatch=RegExp._xxlm;
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash
