OpenMS
Loading...
Searching...
No Matches
RegularExpression.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Timo Sachsenberg $
6// $Authors: Timo Sachsenberg $
7// --------------------------------------------------------------------------
8
9#pragma once
10
11#include <OpenMS/config.h>
12#include <memory>
13#include <string>
14
15namespace OpenMS
16{
17namespace Internal
18{
19 struct RegularExpressionAccess;
20 struct RegularExpressionMatch;
21} // namespace Internal
22
29class OPENMS_DLLAPI RegularExpression
30{
31public:
38 explicit RegularExpression(const std::string& pattern);
43 void assign(const std::string& pattern);
45 std::string str() const;
47 bool empty() const;
49 bool search(const std::string& text, std::string* first_match = nullptr) const;
50
51private:
52 struct Impl;
53 std::shared_ptr<const Impl> impl_;
54 friend struct Internal::RegularExpressionAccess;
55};
56} // namespace OpenMS
Compiled Perl-compatible regular expression, including named capture groups.
Definition RegularExpression.h:30
bool search(const std::string &text, std::string *first_match=nullptr) const
Search text, optionally returning the first complete match.
bool empty() const
True only if no pattern was set; a compiled "" is not empty.
void assign(const std::string &pattern)
Replaces the expression by pattern; copies made earlier keep the old one.
std::shared_ptr< const Impl > impl_
Definition RegularExpression.h:53
RegularExpression()
Default constructor: holds no pattern (empty() is true) and matches like the pattern "".
RegularExpression(const std::string &pattern)
Compiles pattern (Perl syntax)
std::string str() const
The pattern this expression was compiled from; "" if it holds none.
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19