您好! 我有这个正则表达式:
您可以看到正则表达式(?:-|role:)??\binfo-ansible[\s|,]
我试图在这种情况下将所有字符串“ info-ansible”与规则匹配:
这些规则已在正则表达式中实现
在第一场比赛中,您可以看到它与info-ansible,
相匹配
我不希望比赛中包含“,”。
似乎是一个非常简单的问题,但我已经花了很多时间。
链接到在线正则表达式工具的链接中包含以下文本:https://regex101.com/r/Xixz3O/3
答案 0 :(得分:0)
在#include <type_traits>
#include <vector>
template<class T>
struct my_struct {
my_struct() {}
explicit my_struct(T) {}
template <typename U = T>
explicit my_struct(std::vector<U>, std::enable_if_t<!std::is_const_v<U>, int> = 0) {}
};
int main() {
my_struct<const int> s(1);
my_struct<int> t({1, 2});
}
捕获中使用positive lookahead;
因此,使用pip install setuptools==49.6.0
代替whitespace|comma
[\s|,]
简体(Thx @Wiktor Stribiżew);
(?=[\s,])