Uma*_*had 2 regex google-sheets google-apps-script
我想从 google 工作表 A 列的文本字符串中提取前 22 个单词。
这是谷歌表格谷歌表格网址
我在上面的谷歌工作表中的 A2 上使用了以下公式
=regexextract(A2,"[\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]*")
Run Code Online (Sandbox Code Playgroud)
但 B2 细胞给出以下错误
Function REGEXEXTRACT parameter 2 value "[\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]* [\w]*" does not match text of Function REGEXEXTRACT parameter 1 value "Immediate Hiring ! ! Position Business Development Manager Location Dubai Industry Contracting Req Must have minimum 10+ years of UAE sales management Gender Male Preferred Nationality Pakistani Salary AED 10000-15000Send CV to with Sub of email as " BDM " . NB This is one of the clients requirements. The above details are as specified by the".
Run Code Online (Sandbox Code Playgroud)
如何从 A 列中的每个单元格中提取前 22 个单词并在 B 列相应的单元格中显示
欢迎任何基于代码的解决方案或任何基于公式的解决方案。
使用
=regexextract(A2,"\w+(?:\W+\w+){21}")
Run Code Online (Sandbox Code Playgroud)
请参阅正则表达式证明。
解释
--------------------------------------------------------------------------------
\w+ word characters (a-z, A-Z, 0-9, _) (1 or
more times (matching the most amount
possible))
--------------------------------------------------------------------------------
(?: group, but do not capture (21 times):
--------------------------------------------------------------------------------
\W+ non-word characters (all but a-z, A-Z, 0-
9, _) (1 or more times (matching the
most amount possible))
--------------------------------------------------------------------------------
\w+ word characters (a-z, A-Z, 0-9, _) (1 or
more times (matching the most amount
possible))
--------------------------------------------------------------------------------
){21} end of grouping
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
902 次 |
| 最近记录: |