Skip to content

Commit

Permalink
Update 7.string.md (#862)
Browse files Browse the repository at this point in the history
  • Loading branch information
izhuxiaoqing committed Nov 2, 2021
1 parent 781b2cf commit 5072f37
Showing 1 changed file with 24 additions and 24 deletions.
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" |
+---------------+
```
```

0 comments on commit 5072f37

Please sign in to comment.