Javascript RegExp
(Created page with "Javascript RegExp. == Constructor == * '''new RegExp(pattern [, flags])'''<br> Create a RegExp object.<br> Parameters:<br> '''pattern''': Regexp pattern<br> '''flags''': Opt...") |
(→Properties) |
||
Line 32: | Line 32: | ||
* '''ignoreCase'''<br> | * '''ignoreCase'''<br> | ||
− | Boolean. True if case insensitive | + | Boolean. True if case insensitive is enabled, false otherwise.<br> |
* '''basicPosix'''<br> | * '''basicPosix'''<br> | ||
− | Boolean. True if basic POSIX usage | + | Boolean. True if basic POSIX usage is enabled, false otherwise.<br> |
Latest revision as of 10:10, 4 March 2016
Javascript RegExp.
[edit] 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'.
[edit] 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.
[edit] Properties
- ignoreCase
Boolean. True if case insensitive is enabled, false otherwise.
- basicPosix
Boolean. True if basic POSIX usage is enabled, false otherwise.