Into

Modules

Documentation

classPiiRegExpMatcher

#include <PiiRegExpMatcher.h>

An operation that splits strings into pieces based on a regular expression.

Inherits PiiDefaultOperation

Description

Inputs

inputinput text (QString)

Outputs

outputXmatched texts. X is a zero-based index. The first output, output0 will emit the full matched text. The other outputs will emit the matched subexpressions, if any. The number of outputs matches the number of subexpressions in pattern, plus one.
 PiiOperation* pRe = engine.createOperation("PiiRegExpMatcher");
 // Separate path from file name. Output1 will emit the path
 // without a trailing slash, and output2 the file name part.
 pRe->setProperty("pattern", "(^.*)/([^/]+$)

Properties

The regular expression to be matched against input.

Constructors and destructor

Public member functions

( )
void
( )

Protected member functions

virtual void
( )

Executes one round of processing.

Property details

  • QString pattern

    [read, write]

    The regular expression to be matched against input.

    See QRegExp for syntax of valid patterns. Setting this property changes the number of outputs to match the number of subexpressions (plus one).

Function details

  • PiiRegExpMatcher

    ()
  • QString pattern

    ()
  • void setPattern

    ()
  • virtual void process

    ()
    [protected, virtual]

    Executes one round of processing.

    This function is invoked by the processor if the necessary preconditions for a new processing round are met. This function does all the necessary calculations to create output objects and sends them to output sockets.

    Calls to process(), syncEvent(), and setProperty() are synchronized and cannot occur simultaneously. PiiDefaultOperation ensures this by locking processLock() for reading before calling process().

    Note: With time-consuming operations, one should occasionally check that the operation hasn't been interrupted, i.e. that state() returns Running.

    Exceptions
    PiiExecutionException

    whenever an unrecoverable error occurs during a processing round, the operation is interrupted, or finishes execution due to end of input data.

    Reimplemented from PiiDefaultOperation.

Notes (0)

Add a note

Not a single note added yet. Be the first, add yours.