Packagecore.strings
Classpublic class WildExp
InheritanceWildExp Inheritance Object

A wild expression is constructed like a regular expression but is based on a globbing algorithm like the one you found for searching files on a hard-drive.

Syntax :

Rules :

Tips and tricks :

1. find all the words in a string

 
     import core.strings.WildExp ;
     var we:WildExp   = new WildExp( ", WildExp.IGNORECASE | WildExp.MULTIWORD );
     var result:Array = we.test( "any phrases with words inside" );
     //result = [ "any", "phrases", "with", "words", "inside" ];
     

2. find comments in a string

 
     import core.strings.WildExp ;
     var we:WildExp   = new WildExp( "/!/\, WildExp.IGNORECASE | WildExp.MULTIWORD );
     var result:Array = we.test( "toto = \"123\"; /\ello world/" );
     //result = [ "toto = \"123\"; ", "hello world" ] ;
     

3. find the name, arguments and body of a function

 
     import core.strings.WildExp ;
     var we:WildExp = new WildExp( "function ", WildExp.IGNORECASE | WildExp.MULTIWORD );
     result = we.test( "function toto( a, b, c )\r\n{\treturn \"hello world\";\r\n\t}" );
     //result = [ "toto", " a, b, c ", "\r\n", "\treturn \"hello world\";\r\n\t" ];
     



Public Properties
 PropertyDefined By
  questionMarks : Array
The array of all question marks.
WildExp
  source : String
The source of this wildcard.
WildExp
  wildcards : Array
The array of all wildcards.
WildExp
Public Methods
 MethodDefined By
  
WildExp(pattern:String, options:uint = 0)
Creates a new WildExp instance.
WildExp
  
addToQuestionMarks(chr:String):void
Adds a caracter in the questionMarks array, only if the array isn't empty.
WildExp
  
addToWildcards(chr:String):void
Adds a caracter in the wildcards array, only if the array isn't empty.
WildExp
  
test(str:String):*
Test the specific expression in argument.
WildExp
  
toString():String
Returns the string representation of this object.
WildExp
Public Constants
 ConstantDefined By
  IGNORECASE : uint = 1
[static] const the IGNORECASE value (1).
WildExp
  MULTILINE : uint = 2
[static] const the MULTILINE value (2).
WildExp
  MULTIWORD : uint = 4
[static] const the MULTIWORD value (4).
WildExp
  NONE : uint = 0
[static] const the NONE value (0).
WildExp
Property Detail
questionMarksproperty
public var questionMarks:Array

The array of all question marks.

sourceproperty 
public var source:String

The source of this wildcard.

wildcardsproperty 
public var wildcards:Array

The array of all wildcards.

Constructor Detail
WildExp()Constructor
public function WildExp(pattern:String, options:uint = 0)

Creates a new WildExp instance.

Example :

         import core.strings.WildExp ;
         
         var wild:WildExp ;
         
         wild = new WildExp("foo. , WildExp.IGNORECASE ) ;
         
         trace( wild.test("foo") ) ; // false
         trace( wild.test("foo.") ) ; // true
         trace( wild.test("foo.bar") ) ; // true
         trace( wild.test("bar.foo.bar") ) ; // false
         trace( wild.test("FOO.bar") ) ; // false
         

Parameters
pattern:String — The pattern of the evaluator.
 
options:uint (default = 0) — The option flag value.
Method Detail
addToQuestionMarks()method
public function addToQuestionMarks(chr:String):void

Adds a caracter in the questionMarks array, only if the array isn't empty.

Parameters

chr:String

addToWildcards()method 
public function addToWildcards(chr:String):void

Adds a caracter in the wildcards array, only if the array isn't empty.

Parameters

chr:String

test()method 
public function test(str:String):*

Test the specific expression in argument.

Parameters

str:String

Returns
*
toString()method 
public function toString():String

Returns the string representation of this object.

Returns
String — the string representation of this object.
Constant Detail
IGNORECASEConstant
public static const IGNORECASE:uint = 1

const the IGNORECASE value (1).

MULTILINEConstant 
public static const MULTILINE:uint = 2

const the MULTILINE value (2).

MULTIWORDConstant 
public static const MULTIWORD:uint = 4

const the MULTIWORD value (4).

NONEConstant 
public static const NONE:uint = 0

const the NONE value (0).