Create a global regular expression that matches three-letter words
package{ import flash.display.Sprite;
public class Main extends Sprite{ public function Main(){ var regex:RegExp = /b[a-z]{3}b/g; var sentence:String = "This string has two three letter words."; trace( sentence.search( regex ) ); trace( regex.lastIndex ); trace( sentence.search( regex ) ); } } }
Related Scripts with Example Source Code in same category :