| Package | core.strings |
| Class | public class WildExp |
| Inheritance | WildExp Object |
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" ];
| Property | Defined 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 | ||
| Method | Defined 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 | ||
| Constant | Defined 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 | ||
| questionMarks | property |
public var questionMarks:ArrayThe array of all question marks.
| source | property |
public var source:StringThe source of this wildcard.
| wildcards | property |
public var wildcards:ArrayThe array of all wildcards.
| 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.
|
| addToQuestionMarks | () | method |
public function addToQuestionMarks(chr:String):voidAdds a caracter in the questionMarks array, only if the array isn't empty.
Parameters
chr:String |
| addToWildcards | () | method |
public function addToWildcards(chr:String):voidAdds 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 |
* |
| toString | () | method |
public function toString():StringReturns the string representation of this object.
ReturnsString — the string representation of this object.
|
| IGNORECASE | Constant |
public static const IGNORECASE:uint = 1const the IGNORECASE value (1).
| MULTILINE | Constant |
public static const MULTILINE:uint = 2const the MULTILINE value (2).
| MULTIWORD | Constant |
public static const MULTIWORD:uint = 4const the MULTIWORD value (4).
| NONE | Constant |
public static const NONE:uint = 0const the NONE value (0).