forked from ParadoxGameConverters/commonItems
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommonRegexes.h
35 lines (21 loc) · 873 Bytes
/
CommonRegexes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef COMMON_REGEXES_H
#define COMMON_REGEXES_H
// A handful of helpful commonly-used regexes.
namespace commonItems
{
// catchall:
// We grab everything that's NOT =, { or }, OR we grab everything within quotes, except newlines, which we already
// drop in the parser.
inline constexpr const char* catchallRegex = R"([^=^{^}]+|".+")";
// numbers
inline constexpr const char* integerRegex = R"(-?\d+)";
inline constexpr const char* quotedIntegerRegex = R"("-?\d+")";
inline constexpr const char* floatRegex = R"(-?\d+(.\d+)?)";
inline constexpr const char* quotedFloatRegex = R"("-?\d+(.\d+)?")";
// strings
inline constexpr const char* stringRegex = R"([^[:s:]^=^\{^\}^\^\[^\]"]+)";
inline constexpr const char* quotedStringRegex = R"("[^\n"]+")";
// dates
inline constexpr const char* dateRegex = R"(\d+[.]\d+[.]\d+)";
} // namespace commonItems
#endif