Description:
Attach the action of matching the regular expression to a cursor and return the original cursor.
Syntax:
cs.regex(rs,Fi,…)
Note:
The function attaches a computation to cursor cs, which matches the string members in cursor cs with regular expression rs, forms a table sequence consisting of Fi fields and returns it to the original cursor cs. It supports multicursors.
This is a delayed function.
Parameter:
cs |
A cursor whose members are strings |
rs |
Regular expression |
Fi |
Resulting field name |
Option:
@c |
Case insensitive |
@u |
Use Unicode to match |
Return value:
Cursor
Example:
|
A |
|
1 |
["1,Rebecca","2,ashley","3,Rachel","4,Emily","5,Ashley","6,Matthew", "7,Alexis","8,Megan","9,Victoria","10,Ryan"] |
|
2 |
=A1.cursor() |
Return a cursor. |
3 |
=A2.regex("(.*),(A.*)";id,name) |
Attach a computation to cursor A2, which will match members starting with A after the comma and return the original cursor A2; the computation is by default case sensitive. |
4 |
=A2.fetch() |
Fetch data from cursor A2 where A3’s computation is executed:
|
Use @c option to enable a case-insensitive computation:
|
A |
|
1 |
["1,Rebecca","2,ashley","3,Rachel","4,Emily","5,Ashley","6,Matthew", "7,Alexis","8,Megan","9,Victoria","10,Ryan"] |
|
2 |
=A1.cursor() |
Return a cursor. |
3 |
=A2.regex@c("(.*),(A.*)";id,name) |
Attach a computation to cursor A2, which will match members starting with A or a after the comma and return the original cursor A2; @c option works to enable a case-insensitive computation. |
4 |
=A2.fetch() |
Fetch data from cursor A2 where A3’s computation is executed:
|
When @u option works:
|
A |
|
1 |
["销售部,李英梅","人事部,王芳","技术部,张峰","销售部,孙超"] |
|
2 |
=A1.cursor() |
Return a cursor. |
3 |
=A2.regex@u("(\\u9500\\u552e\\u90e8),(.*)";部门,员工姓名) |
Attach a computation to cursor A2, which, with @u option, will match members starting with "销售部" and return the original cursor A2. |
4 |
=A2.fetch() |
Fetch data from cursor A2 where A3’s computation is executed:
|
Related function: