Google Spreadsheets正则表达式不区分大小写(Regexreplace) [英] Google Spreadsheets Regex Case Insensitive (Regexreplace)

查看:145
本文介绍了Google Spreadsheets正则表达式不区分大小写(Regexreplace)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Google Spreadsheets中使用regexreplace函数创建一个不区分大小写的正则表达式查询。那可能吗?我试过了\i标志,并得到了一个#REF错误,表示该表达式无效:= regexreplace(Test,t\i,)给出错误,我希望得到es作为最终结果。



这可能吗?在Google Spreadsheets中是否存在区分大小写的标志?

感谢您的提前!

解决方案 AFAIK是启用不区分大小写匹配的唯一方法,它是Google文档中的JavaScript API。 显然, RE2 语法不支持内联(?i)不区分大小写的修饰符:

  = REGEXREPLACE(Test,(?i)t,)

另一个可行的方法是使用一个Character类,添加两个字母 T ..

  = REGEXREPLACE(Test,[Tt],)


I'm trying to create a case insensitive regex query in Google Spreadsheets with the regexreplace function. Is that possible? I've tried the \i flag and got a #REF error saying the expression was invalid: =regexreplace("Test","t\i","") gives an error when I would hope to get "es" as the final result.

Is it possible? Is there a flag for case sensitivity in Google Spreadsheets?

Thanks in advance!

解决方案

AFAIK, the only way to enable case-insensitive matching is JavaScript API in google docs.

Apparently, RE2 syntax does support the inline (?i) case-insensitive modifier:

=REGEXREPLACE("Test", "(?i)t", "")

An alternative that will work is using a Character class, adding both cases of the letter T..

=REGEXREPLACE("Test", "[Tt]", "")

这篇关于Google Spreadsheets正则表达式不区分大小写(Regexreplace)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆