userver
C++ Async Framework
Loading...
Searching...
No Matches
regex.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/utils/regex.hpp
4
/// @brief @copybrief utils::regex
5
6
#
include
<
string
>
7
8
#
include
<
userver
/
utils
/
fast_pimpl
.
hpp
>
9
10
USERVER_NAMESPACE_BEGIN
11
12
namespace
utils {
13
14
/// @ingroup userver_universal userver_containers
15
///
16
/// @brief Small alias for boost::regex / std::regex without huge includes
17
class
regex
final
{
18
public
:
19
regex();
20
explicit
regex(std::string_view pattern);
21
22
~regex();
23
24
regex(
const
regex&);
25
regex(regex&&)
noexcept
;
26
27
regex& operator=(
const
regex&);
28
regex& operator=(regex&&)
noexcept
;
29
30
std::string str()
const
;
31
32
private
:
33
struct
Impl;
34
utils::FastPimpl<Impl, 16, 8> impl_;
35
36
friend
bool
regex_match
(std::string_view str,
const
regex& pattern);
37
friend
bool
regex_search
(std::string_view str,
const
regex& pattern);
38
friend
std::string
regex_replace
(std::string_view str,
const
regex& pattern,
39
std::string_view repl);
40
};
41
42
/// @brief Determines whether the regular expression matches the entire target
43
/// character sequence
44
bool
regex_match
(std::string_view str,
const
regex& pattern);
45
46
/// @brief Determines whether the regular expression matches anywhere in the
47
/// target character sequence
48
bool
regex_search
(std::string_view str,
const
regex& pattern);
49
50
/// @brief Create a new string where all regular expression matches replaced
51
/// with repl
52
std::string
regex_replace
(std::string_view str,
const
regex& pattern,
53
std::string_view repl);
54
55
}
// namespace utils
56
57
USERVER_NAMESPACE_END
userver
utils
regex.hpp
Generated on Wed May 15 2024 22:35:19 for userver by
Doxygen
1.10.0