Flash正则例子

var jack:String = "zhuhai";

var arr:Array = ["23", "4", "67", "23", "76", "23"];

var str:String = arr.join("|");

trace(str);



var strReg:String = "23"

strReg = "\(" + strReg + ")";

var m_reg:RegExp = new RegExp(strReg, "g");

trace(m_reg);

str = str.replace(m_reg, "dd");

trace(str);







var a:RegExp = /abc/g;

var b:String = "mebius abc ashan";



trace(b.match(a));







var a:RegExp = /abc/g;

var b:String = "mebius abc ashan abc";



trace(b.match(a));





var a:RegExp = /\r/g;

var b:String = "mebius \rabc \rashan \rabc";



trace(b.match(a));



 

  

你可能感兴趣的:(Flash)