The Gaudi Framework master (9cc87df9)
Loading...
Searching...
No Matches
Gaudi::Utils::RegEx Namespace Reference

RegeEx: nemspace to hold gaudi regular expression checking. More...

Classes

class  matchList

Functions

template<typename T>
bool matchOr (const std::string &test, const T &regexps)
 return true if the string is in any of the regex's
template<typename T>
bool matchAnd (const std::string &test, const T &regexps)
 return true if the string is in all of the regex's

Detailed Description

RegeEx: nemspace to hold gaudi regular expression checking.

Parameters
matchOrreturn true if test is in any of the regexps
matchAndreturn true if test is in all of the regexps
Author
Rob Lambert Rob.L.nosp@m.ambe.nosp@m.rt@ce.nosp@m.rn.c.nosp@m.h
Date
2009-07-29

Function Documentation

◆ matchAnd()

template<typename T>
bool Gaudi::Utils::RegEx::matchAnd ( const std::string & test,
const T & regexps )

return true if the string is in all of the regex's

Parameters
std::stringtest [IN]: string to match
container<std::string>regexps [IN]: container of regex strings can be any container with a const_iterator, begin and end

If you need to do this more than once, please first create a matchList object, and then invoke its And method.

Definition at line 80 of file RegEx.h.

80 {
81 // compares the string in test, to the regexps in a container
82 //
83 return std::all_of( std::begin( regexps ), std::end( regexps ),
84 [&]( typename T::const_reference i ) { return std::regex_match( test, std::regex{ i } ); } );
85 }
constexpr bool all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
basic_regex< char > regex
bool regex_match(_Bi_iter __s, _Bi_iter __e, match_results< _Bi_iter, _Alloc > &__m, const basic_regex< _Ch_type, _Rx_traits > &__re, regex_constants::match_flag_type __flags=regex_constants::match_default)
constexpr auto begin(_Container &__cont) -> decltype(__cont.begin())
constexpr auto end(_Container &__cont) -> decltype(__cont.end())

◆ matchOr()

template<typename T>
bool Gaudi::Utils::RegEx::matchOr ( const std::string & test,
const T & regexps )

return true if the string is in any of the regex's

Parameters
std::stringtest [IN]: string to match
container<std::string>regexps [IN]: container of regex strings can be any container with a const_iterator, begin and end

If you need to do this more than once, please first create a matchList object, and then invoke its Or method.

Definition at line 64 of file RegEx.h.

64 {
65 // compares the string in test, to the regexps in a container
66 //
67 return std::any_of( std::begin( regexps ), std::end( regexps ),
68 [&]( typename T::const_reference i ) { return std::regex_match( test, std::regex{ i } ); } );
69 }
constexpr bool any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)