Google Spreadsheets正则表达式不区分大小写(Regexreplace) [英] Google Spreadsheets Regex Case Insensitive (Regexreplace)
问题描述
我试图在Google Spreadsheets中使用regexreplace函数创建一个不区分大小写的正则表达式查询。那可能吗?我试过了\i标志,并得到了一个#REF错误,表示该表达式无效:= regexreplace(Test,t\i,)给出错误,我希望得到es作为最终结果。
这可能吗?在Google Spreadsheets中是否存在区分大小写的标志?
感谢您的提前!
(?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屋!