@stdlib/utils
Version:
Standard utilities.
30 lines (21 loc) • 544 B
Plain Text
{{alias}}( str )
Parses a regular expression string and returns a new regular expression.
Provided strings should be properly escaped.
If unable to parse a string as a regular expression, the function returns
`null`.
Parameters
----------
str: string
Regular expression string.
Returns
-------
out: RegExp|null
Regular expression or null.
Examples
--------
> var re = {{alias}}( '/beep/' )
/beep/
> re = {{alias}}( '/beep' )
null
See Also
--------