gpt4 book ai didi

c - 在 c 中使用 perl 正则表达式

转载 作者:太空宇宙 更新时间:2023-11-04 06:07:36 24 4
gpt4 key购买 nike

what does this regex match?

我如何在 C 语言中使用这个正则表达式?

如果我这样做会出错:

if (regcomp(&reg, "/[^\\]\]/", REG_EXTENDED | REG_ICASE) != 0) 

错误:

warning: unknown escape sequence '\]'

提前致谢。

最佳答案

我认为你需要转义你的反斜杠:

from "/[^\\]\]/" to "/[^\\\\]\\]/"

关于c - 在 c 中使用 perl 正则表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6999536/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com