V4.1
Expression, Operand
=~
judges if a sting is in accordance with a regular expression format.
Syntax:
- Expression:
<string>
=~ "<regexp>
" - Operand: see list below
Name | Type | Specification | Description |
---|---|---|---|
string | ATTR(string) | / | The string to be judged |
regexp | string | / | A regular expression, a format to express the string in |
Constant
Example: judge if String "adfAWa" is composed of uncapitalized letters.
```js return "adfAWa" =~ "^[a-z]+$" ```Alias
Example: find 10 email addresses and judge if their formats are [email protected] or [email protected]
find().nodes({@email}) as n
limit 10
return n.address, n.address =~ "^[a-zA-Z0-9_.-]+@[a-zA-Z0-9]+\.(com|cn)$"
Property
Example: find 10 email addresses whose formats are [email protected] or [email protected]
find().nodes({@email.address =~ "^[a-zA-Z0-9_.-]+@[a-zA-Z0-9]+\.(com|cn)$"}) as n
limit 10
return n{*}