Javascript RegExp
Javascript RegExp.
Constructor
- new RegExp(pattern [, flags])
Create a RegExp object.
Parameters:
pattern: Regexp pattern
flags: Optional list of flags:
'i': Enable case insensitive match. Disabled by default
'b': Enable basic POSIX regexp usage. Disabled by default (e.g. default is to use POSIX Extended Expression syntax)
NOTE: Flags parsing stops on unknown flag. E.g. 'iab' will apply 'i' but not 'b'.
Methods
- test(str)
Test for matching.
Parameters:
str: String to test
Return:
TRUE if matched, FALSE if not.
- valid()
Check if the pattern given in constructor is a valid regexp expression.
Return:
TRUE if the RegExp holds a valid pattern, FALSE if not.
NOTE: An invalid pattern won't match anything.
Properties
- ignoreCase
Boolean. True if case insensitive is enabled, false otherwise.
- basicPosix
Boolean. True if basic POSIX usage is enabled, false otherwise.