Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Y
YAT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software Control System
Libraries
YAT
Commits
f1aeb454
Commit
f1aeb454
authored
Mar 28, 2024
by
Stéphane Poirier
Browse files
Options
Downloads
Patches
Plain Diff
[Regex] some ready-to-use patterns in Regex::Pattern: number, dec_octet, ipv4_addr
parent
3d692cba
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/yat/regex/Regex.h
+9
-0
9 additions, 0 deletions
include/yat/regex/Regex.h
src/regex/Regex.cpp
+6
-0
6 additions, 0 deletions
src/regex/Regex.cpp
with
15 additions
and
0 deletions
include/yat/regex/Regex.h
+
9
−
0
View file @
f1aeb454
...
...
@@ -134,6 +134,7 @@
namespace
yat
{
// ============================================================================
//! \class Regex
//! \brief Wrapper over the GNU Regular expression processor
...
...
@@ -147,6 +148,14 @@ class YAT_DECL Regex
{
public:
//! Some basic patterns
struct
Pattern
{
static
const
String
number
;
//! real number with or without exposant
static
const
String
dec_octet
;
//! decimal octet (integer number in [0-255])
static
const
String
ipv4_addr
;
//! ipv4 address (dec_octet.dec_octer.dec_octet.dec_octet)
};
enum
CompFlags
{
basic
=
1
,
...
...
This diff is collapsed.
Click to expand it.
src/regex/Regex.cpp
+
6
−
0
View file @
f1aeb454
...
...
@@ -67,6 +67,12 @@ typedef YAT_WEAK_PTR(::regex_t) CompiledRegexWPtr;
Mutex
Regex
::
s_mtx
;
#endif
const
std
::
string
_DEC_OCTET
=
"([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])"
;
const
String
Regex
::
Pattern
::
number
=
R"([\+\-]?([0-9]+|\.[0-9]+|[0-9]+\.|[0-9]+\.[0-9]+)([eE][\+\-]?[0-9]+)?)"
;
const
String
Regex
::
Pattern
::
dec_octet
=
_DEC_OCTET
;
const
String
Regex
::
Pattern
::
ipv4_addr
=
_DEC_OCTET
+
R"(\.)"
+
_DEC_OCTET
+
R"(\.)"
+
_DEC_OCTET
+
R"(\.)"
+
_DEC_OCTET
;
// ============================================================================
// class RegexCache
// Simple FIFO cache
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment