Skip to main content
January 8, 2008
Question

RegExp > Match method is crashing. why?

  • January 8, 2008
  • 1 reply
  • 186 views
with below code, match method crash

var str:String="<p><b><i>The Test-01 RegExp class</i>lets you work</b>with \nregular expressions, which are patterns that you can use to perform searches in strings and to replace text in strings.<p>You can create a new RegExp object by using the <code>new RegExp()to a variable:</p>";
//
function tryIt(s:String) {
trace(s.match(/^\w*/gm)); // Match a word at the beginning of the string.


}
tryIt(str);

any succestion ?

regards,
Burak
delizade@gmail.com
www.delizade.com
This topic has been closed for replies.

1 reply

Inspiring
January 8, 2008
I tried your script, and the match does not "crash" -- it simply returns no
matches.

\w stands for word character -- usually [A-Za-z0-9_]

Your string starts with < (an illegal word character), so you shouldn't
expect to find a match.