Stroika Library 3.0d18
 
Loading...
Searching...
No Matches
Stroika::Foundation::Characters::RegularExpression Class Reference

RegularExpression is a compiled regular expression which can be used to match on a String class. More...

#include <RegularExpression.h>

Public Types

enum class  SyntaxType {
  eECMAScript = regex_constants::ECMAScript , eBasic = regex_constants::basic , eExtended = regex_constants::extended , eAwk = regex_constants::awk ,
  eGrep = regex_constants::grep , eEGrep = regex_constants::egrep , eDEFAULT = eECMAScript
}
 

Public Member Functions

 RegularExpression ()
 

Static Public Attributes

static const RegularExpression kNONE {"(?!)"sv}
 
static const RegularExpression kAny {".*"sv}
 

Detailed Description

RegularExpression is a compiled regular expression which can be used to match on a String class.

This class is a simple wrapper on the std::wregex class.

Definition at line 25 of file RegularExpression.h.

Member Enumeration Documentation

◆ SyntaxType

Constructor & Destructor Documentation

◆ RegularExpression()

Stroika::Foundation::Characters::RegularExpression::RegularExpression ( )
explicit
Note
RegularExpression {} creates a special regular expression that matches nothing.
RegularExpression (String re) throws std::regex_error () if provided an invalid regular expression.
The default syntax is ECMAScript.
Example Usage
// see http://en.cppreference.com/w/cpp/regex/ecmascript
const auto kSingleWhitespaceChar = RegularExpression{"[[:space:]]"sv};
const auto kSeriesOfWhitespaceCharacters = RegularExpression{"\\s+"sv};
RegularExpression is a compiled regular expression which can be used to match on a String class.

Definition at line 12 of file RegularExpression.inl.

Member Data Documentation

◆ kNONE

const RegularExpression Stroika::Foundation::Characters::RegularExpression::kNONE {"(?!)"sv}
static

Predefined regular expression that matches nothing.

Note
Since this is a static object, beware, it cannot be (safely) used before or after main
Equivalent to
const RegularExpression kMatchNone ("(?!)"); // OR
const RegularExpression kMatchNoneAlternative{};

Definition at line 96 of file RegularExpression.h.

◆ kAny

const RegularExpression Stroika::Foundation::Characters::RegularExpression::kAny {".*"sv}
static

Predefined regular expression that matches anything.

Note
Since this is a static object, beware, it cannot be (safely) used before or after main
Equivalent to

Definition at line 108 of file RegularExpression.h.


The documentation for this class was generated from the following files: