关于正则表达式的使用 #91
-
|
项目中的模糊匹配功能需要用到对于中文的正则表达式匹配,但通过查阅各种网站都没能找到匹配中文子串的教学资料(最多只是匹配中文,对于子串的问题没有资料),请问能提供一些学习网址,或者参考资料吗? |
Beta Was this translation helpful? Give feedback.
Answered by
RicoloveFeng
Mar 1, 2022
Replies: 3 comments 1 reply
-
|
如果只是判断字符串是否包含某个子串,没必要正则吧, int main()
{
string a{"冬奥会纪念币"};
cout << a.find("纪念币") << endl;
cout << (a.find("冰墩墩") == string::npos ? "未找到":"找到了");
return 0;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
RicoloveFeng
-
|
嗯嗯,这个有再弄,但是还是想学习一下正则,hh |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
好的,谢谢! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
如果只是判断字符串是否包含某个子串,没必要正则吧,