http://help.adobe.com/en_US/AS3LCR/Flash_10.0/String.html#replace()

문자열에서 sh 를 sch 로 바꾸는 방법

1. 검색 과정 중 처음에 발생하는 결과에 대해서만 교체가 이루어진다.
var myPattern:RegExp = /sh/;  
var str:String = "She sells seashells by the seashore.";
trace(str.replace(myPattern, "sch"));  
   // She sells seaschells by the seashore.
2. global (g) 옵션을 붙여서 패턴과 같은 모든 결과에 대해 교체
var myPattern:RegExp = /sh/g;  
var str:String = "She sells seashells by the seashore.";
trace(str.replace(myPattern, "sch"));  
   // She sells seaschells by the seaschore.
3. ignore (i)옵션을 붙여서 대소문자 구분없이 검색한다.
var myPattern:RegExp = /sh/gi;  
var str:String = "She sells seashells by the seashore.";
trace(str.replace(myPattern, "sch"));  
   // sche sells seaschells by the seaschore.
저작자 표시 비영리 변경 금지