Tag Archives: Regular Expressions

More on Regular Expressions!

i was trying to understand what’s happening behind scenes in the Log Class in Flex Framework
if you digg a little bit in their Classes you’ll find something like this

1
2
3
4
5
6
7
8
9
10
11
12
13
public function debug(msg:String, … rest):void
{
if (hasEventListener(LogEvent.LOG))
{
// replace all of the parameters [...]

Posted in AS3, General | Tagged | Leave a comment

Validating a String

well this is a handy code snippet to validate a string
if you want to avoid some bad words, this is for you:

1
2
3
4
5
6
7
8
9
10
11
12
 
function isValid(str:String):Boolean {
var regExp:RegExp = /\b(badword|nastyWord)\b/i;
var _isValid:Boolean = !regExp.test(str);
return _isValid;
}
 
var _inValidMessage = "this is a example for a [...]

Posted in AS3, General | Tagged | Leave a comment