一、C++标准库<regex.h>
regex_replace函数一共包含三个参数:
参数一:需要被搜索替换的元字符串
参数二:正则表达式元素
参数三:被替换后的字符串。
#include <iostream>
#include <string>
#include <regex>
using namespace std;
int main() {
string str = "Mely Lenient Is A Bad Programmer!";
regex pattern("Bad");
cout << regex_replace(str, pattern, "Good") << endl;
return 0;
}
C++标准库regex_replace函数参数介绍
博客介绍了C++标准库<regex.h>中regex_replace函数的参数。该函数有三个参数,分别是需要被搜索替换的元字符串、正则表达式元素以及被替换后的字符串。
3570

被折叠的 条评论
为什么被折叠?



