• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Doc
  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Products
    • Automation Designer
    • HMI Designer
    • Maritime HMIs
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Framework - Automation
  • SearchReplace
  • 5.0.0

SearchReplace Class

(Automation::SearchReplace)

The SearchReplace operator can be used to transform string input to output using either simple search and replace or more complex POSIX regular expressions search and replace. More...

Header: #include <SearchReplace>
Inherits: CDPOperator<std::string>
  • List of all members, including inherited members

Public Functions

~SearchReplace() override = default

Reimplemented Public Functions

virtual unsigned int Process() override
  • 18 public functions inherited from CDPOperator
  • 17 public functions inherited from CDPOperatorBase
  • 49 public functions inherited from CDPBaseObject
  • 27 public functions inherited from CDP::StudioAPI::CDPNode
  • 22 public functions inherited from CDP::StudioAPI::ICDPNode

Additional Inherited Members

  • 1 public variable inherited from CDPOperatorBase
  • 1 static public member inherited from CDPBaseObject
  • 1 protected function inherited from CDP::StudioAPI::CDPNode
  • 8 protected variables inherited from CDPOperator
  • 5 protected variables inherited from CDPOperatorBase
  • 10 protected variables inherited from CDPBaseObject

Detailed Description

The SearchReplace operator can be used to transform string input to output using either simple search and replace or more complex POSIX regular expressions search and replace.

The SearchReplace operator has the following properties:

PropertyDescription
RegexWhen set, then the POSIX regular expression search and replace is used, otherwise simple search for Search strings and replace them with Replace sting method is used.
SearchPattern to search for. When Regex is set, then POSIX regular expression search pattern with search groups to find from input.
ReplaceText to replace found pattern with. When Regex is set, then references to the POSIX regular expression matchs groups like $1, $2 can be used here).

Note: The input string will be forwarded to output unchanged when the Search pattern is not matching at all.

For example, the following Search and Replace patterns can be used to add a prefix and suffix to the input string (for example "some-text" becomes to "Prefix,some-text,suffix"):

PropertyDescription
Regex1
Search(.+)
ReplacePrefix,$1,suffix

Or for example, the following Search and Replace patterns can be used to replace all dots in the input string to the hyphens in output (for example "some.text.string" becomes to "some-text-string").

PropertyDescription
Regex0
Search.
Replace-

Below is a table with the most useful special characters in POSIX {http://en.wikipedia.org/wiki/Regular_expression} {regular expression} patterns:

(...)Specifies a block (regex group). Anything that is matched inside parenthesis can be references using $1 $2 etc in the Replace field.
.Matches any character
\.Matches . character (dot)
\sMatches any whitespace character (space, tab or newline)
\SMatches any non-whitespace character (any character except space, tab and newline)
\dMatches any digit character
\DMatches any non-digit character
\wMatches any alphanumeric character (letter, number or underscore)
\WMatches any non-letter character (so it is not a letter, number nor underscore)
+Indicates one or more occurrences of the preceding elements. For example, S+ causes to match one or more sequential non-whitespace characters.
*Indicates zero or more occurrences of the preceding elements. For example, S* causes to match any number (or zero) sequential non-whitespace characters.

You can learn more about regex expression possibilities, at:

  • Boost regex page
  • Boost format syntax
  • Wikipedia regex page

Member Function Documentation

[default] SearchReplace::~SearchReplace()

Destroys the instance of SearchReplace.

[override virtual] unsigned int SearchReplace::Process()

Reimplemented from CDPOperatorBase::Process().

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

My account

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

© Copyright 2025 CDP Technologies. Privacy and cookie policy.

Return to top