nngn
Loading...
Searching...
No Matches
regexp.h
Go to the documentation of this file.
1#ifndef NNGN_UTILS_REGEXP_H
2#define NNGN_UTILS_REGEXP_H
3
4#include <regex>
5
6namespace nngn {
7
8inline std::string regexp_replace(
9 std::string &&s, const std::regex &r, const char *fmt)
10{
11 const auto b = begin(s), e = end(s);
12 s.erase(std::regex_replace(b, b, e, r, fmt), e);
13 return std::move(s);
14}
15
16inline std::string regexp_replace(
17 std::string_view s, const std::regex &r, const char *fmt)
18{
19 return regexp_replace(std::string{s}, r, fmt);
20}
21
22}
23
24#endif
function DEMO text end
Definition: demo0.lua:6
r
Definition: gamma.lua:7
std::chrono::seconds s
Definition: timing.cpp:6
e
Definition: math.lua:4
Definition: audio.cpp:7
constexpr const R * begin(const T< R > &v)
Definition: vec.h:207
std::string fmt(auto &&...args)
Definition: string.h:11
std::string regexp_replace(std::string &&s, const std::regex &r, const char *fmt)
Definition: regexp.h:8