views:

321

answers:

1

I was curious of just how much stress AS3 Regular Expression testing can impose on the end-user's pc. Is this something that should be used in moderation, or can most computers handle the exhaustive use of it?

+1  A: 

Only in pathological cases. In practice you never have to worry about it. Regular expressions are very efficient.

For example, many regular expression engines have serious performance problems failing to match a string of 'a's not ending with b with this type of expression.

/a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*[b]/

Testing will quickly identify odd edge cases like this one. Otherwise, just use common sense like not creating multiple RegExp objects if you repeatedly check the same pattern.

Tmdean