@@ -37,21 +37,13 @@ struct regex_match_t : public op<regex_match_t>
3737 constexpr static const char * n_description=" must not match expression" ;
3838
3939 template <typename T1 , typename T2 >
40- constexpr bool operator () (const T1 & a, const T2 & b,
41- std::enable_if_t <
42- !std::is_same<T2 ,boost::regex>::value,
43- void *
44- > =nullptr ) const
40+ constexpr bool operator () (const T1 & a, const T2 & b) const
4541 {
4642 return boost::regex_match (a,boost::regex (b));
4743 }
4844
4945 template <typename T1 , typename T2 >
50- constexpr bool operator () (const T1 & a, const T2 & b,
51- std::enable_if_t <
52- std::is_same<T2 ,boost::regex>::value,
53- void *
54- > =nullptr ) const
46+ constexpr bool operator () (const T1 & a, const boost::regex& b) const
5547 {
5648 return boost::regex_match (a,b);
5749 }
@@ -82,6 +74,52 @@ struct regex_nmatch_t : public op<regex_nmatch_t>
8274*/
8375constexpr regex_nmatch_t regex_nmatch{};
8476
77+ /* *
78+ * @brief Definition of operator "contains regular expression".
79+ */
80+ struct regex_contains_t : public op <regex_contains_t >
81+ {
82+ constexpr static const char * description=" must contain expression" ;
83+ constexpr static const char * n_description=" must not contain expression" ;
84+
85+ template <typename T1 , typename T2 >
86+ constexpr bool operator () (const T1 & a, const T2 & b) const
87+ {
88+ return boost::regex_search (a,boost::regex (b));
89+ }
90+
91+ template <typename T1 , typename T2 >
92+ constexpr bool operator () (const T1 & a, const boost::regex& b) const
93+ {
94+ return boost::regex_search (a,b);
95+ }
96+ };
97+
98+ /* *
99+ @brief Operator "contains regular expression".
100+ */
101+ constexpr regex_contains_t regex_contains{};
102+
103+ /* *
104+ * @brief Definition of operator "not contain regular expression".
105+ */
106+ struct regex_ncontains_t : public op <regex_ncontains_t >
107+ {
108+ constexpr static const char * description=regex_contains_t ::n_description;
109+ constexpr static const char * n_description=regex_contains_t ::description;
110+
111+ template <typename T1 , typename T2 >
112+ constexpr bool operator () (const T1 & a, const T2 & b) const
113+ {
114+ return !regex_contains (a,b);
115+ }
116+ };
117+
118+ /* *
119+ @brief Operator "not contain regular expression".
120+ */
121+ constexpr regex_ncontains_t regex_ncontains{};
122+
85123/* *
86124 * @brief Format boost::regex operand.
87125 */
0 commit comments