Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 7.string.md #862

Merged
merged 1 commit into from
Nov 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions docs-2.0/3.ngql-guide/5.operators/7.string.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ You can use the following string operators for concatenating, querying, and matc

```ngql
nebula> RETURN 'a' + 'b';
+-------+
| (a+b) |
+-------+
| "ab" |
+-------+
+-----------+
| ("a"+"b") |
+-----------+
| "ab" |
+-----------+
nebula> UNWIND 'a' AS a UNWIND 'b' AS b RETURN a + b;
+-------+
| (a+b) |
Expand All @@ -50,25 +50,25 @@ nebula> MATCH (s:player)-[e:serve]->(t:team) WHERE id(s) == "player101" \
nebula> GO FROM "player101" OVER serve WHERE (STRING)properties(edge).start_year CONTAINS "19" AND \
properties($^).name CONTAINS "ny" \
YIELD properties($^).name, properties(edge).start_year, properties(edge).end_year, properties($$).name;
+----------------+------------------+----------------+--------------+
+---------------------+-----------------------------+---------------------------+---------------------+
| properties($^).name | properties(EDGE).start_year | properties(EDGE).end_year | properties($$).name |
+----------------+------------------+----------------+--------------+
| "Tony Parker" | 1999 | 2018 | "Spurs" |
+----------------+------------------+----------------+--------------+
+---------------------+-----------------------------+---------------------------+---------------------+
| "Tony Parker" | 1999 | 2018 | "Spurs" |
+---------------------+-----------------------------+---------------------------+---------------------+

nebula> GO FROM "player101" OVER serve WHERE !(properties($$).name CONTAINS "ets") \
YIELD properties($^).name, properties(edge).start_year, properties(edge).end_year, $$.team.name;
+----------------+------------------+----------------+--------------+
YIELD properties($^).name, properties(edge).start_year, properties(edge).end_year, properties($$).name;
+---------------------+-----------------------------+---------------------------+---------------------+
| properties($^).name | properties(EDGE).start_year | properties(EDGE).end_year | properties($$).name |
+----------------+------------------+----------------+--------------+
| "Tony Parker" | 1999 | 2018 | "Spurs" |
+----------------+------------------+----------------+--------------+
+---------------------+-----------------------------+---------------------------+---------------------+
| "Tony Parker" | 1999 | 2018 | "Spurs" |
+---------------------+-----------------------------+---------------------------+---------------------+
```

### `(NOT) IN`

```ngql
nebula> RETURN 1 IN [1,2,3], "Yao" NOT IN ["Yi", "Tim", "Kobe"], NULL IN ["Yi", "Tim", "Kobe"]
nebula> RETURN 1 IN [1,2,3], "Yao" NOT IN ["Yi", "Tim", "Kobe"], NULL IN ["Yi", "Tim", "Kobe"];
+----------------+------------------------------------+-------------------------------+
| (1 IN [1,2,3]) | ("Yao" NOT IN ["Yi","Tim","Kobe"]) | (NULL IN ["Yi","Tim","Kobe"]) |
+----------------+------------------------------------+-------------------------------+
Expand All @@ -79,14 +79,14 @@ nebula> RETURN 1 IN [1,2,3], "Yao" NOT IN ["Yi", "Tim", "Kobe"], NULL IN ["Yi",
### `(NOT) STARTS WITH`

```ngql
nebula> RETURN 'apple' STARTS WITH 'app', 'apple' STARTS WITH 'a', 'apple' STARTS WITH toUpper('a')
nebula> RETURN 'apple' STARTS WITH 'app', 'apple' STARTS WITH 'a', 'apple' STARTS WITH toUpper('a');
+-----------------------------+---------------------------+------------------------------------+
| ("apple" STARTS WITH "app") | ("apple" STARTS WITH "a") | ("apple" STARTS WITH toUpper("a")) |
+-----------------------------+---------------------------+------------------------------------+
| true | true | false |
+-----------------------------+---------------------------+------------------------------------+

nebula> RETURN 'apple' STARTS WITH 'b','apple' NOT STARTS WITH 'app'
nebula> RETURN 'apple' STARTS WITH 'b','apple' NOT STARTS WITH 'app';
+---------------------------+---------------------------------+
| ("apple" STARTS WITH "b") | ("apple" NOT STARTS WITH "app") |
+---------------------------+---------------------------------+
Expand All @@ -97,7 +97,7 @@ nebula> RETURN 'apple' STARTS WITH 'b','apple' NOT STARTS WITH 'app'
### `(NOT) ENDS WITH`

```ngql
nebula> RETURN 'apple' ENDS WITH 'app', 'apple' ENDS WITH 'e', 'apple' ENDS WITH 'E', 'apple' ENDS WITH 'b'
nebula> RETURN 'apple' ENDS WITH 'app', 'apple' ENDS WITH 'e', 'apple' ENDS WITH 'E', 'apple' ENDS WITH 'b';
+---------------------------+-------------------------+-------------------------+-------------------------+
| ("apple" ENDS WITH "app") | ("apple" ENDS WITH "e") | ("apple" ENDS WITH "E") | ("apple" ENDS WITH "b") |
+---------------------------+-------------------------+-------------------------+-------------------------+
Expand All @@ -115,16 +115,16 @@ Nebula Graph supports filtering by using regular expressions. The regular expres

```ngql
nebula> RETURN "384748.39" =~ "\\d+(\\.\\d{2})?";
+----------------------------+
| (384748.39=~\d+(\.\d{2})?) |
+----------------------------+
| true |
+----------------------------+
+--------------------------------+
| ("384748.39"=~"\d+(\.\d{2})?") |
+--------------------------------+
| true |
+--------------------------------+

nebula> MATCH (v:player) WHERE v.name =~ 'Tony.*' RETURN v.name;
+---------------+
| v.name |
+---------------+
| "Tony Parker" |
+---------------+
```
```