Regex empty match
Regex empty match
Function
Describes an expression that may match the empty string.
Syntax
regex(pattern, flags)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| pattern | String | No | '' | May contain empty matching quantifiers such as *, ?, {0,n}. |
| flags | String | No | '' | Regular flags. |
Return value
| Type | Description |
|---|---|
| Regex | Returns a Regex object. |
Example
rule = regex('^.*$', '') result = rule.test('') // Output: true print result
Notes
- Empty matching may produce unintuitive results in replace and match. The boundaries should be clear when writing business rules.