ClassesClasses | | Operators

tuple_regexp_selecttuple_regexp_selectTupleRegexpSelectTupleRegexpSelect (Operator)

Name

tuple_regexp_selecttuple_regexp_selectTupleRegexpSelectTupleRegexpSelect — Select tuple elements matching a regular expression.

Signature

tuple_regexp_select( : : Data, Expression : Selection)

Herror tuple_regexp_select(const char* Data, const char* Expression, char* Selection)

Herror T_tuple_regexp_select(const Htuple Data, const Htuple Expression, Htuple* Selection)

void TupleRegexpSelect(const HTuple& Data, const HTuple& Expression, HTuple* Selection)

HTuple HTuple::TupleRegexpSelect(const HTuple& Expression) const

static void HOperatorSet.TupleRegexpSelect(HTuple data, HTuple expression, out HTuple selection)

HTuple HTuple.TupleRegexpSelect(HTuple expression)

Description

tuple_regexp_selecttuple_regexp_selectTupleRegexpSelectTupleRegexpSelectTupleRegexpSelect applies the regular expression in ExpressionExpressionExpressionExpressionexpression to one or more input strings in DataDataDataDatadata, and returns the matching string elements in SelectionSelectionSelectionSelectionselection. This is convenient, e.g., for filtering a list of files obtained using the operator list_fileslist_filesListFilesListFilesListFiles.

Please refer to the documentation of tuple_regexp_matchtuple_regexp_matchTupleRegexpMatchTupleRegexpMatchTupleRegexpMatch for syntax and options of regular expressions. Additionally, tuple_regexp_selecttuple_regexp_selectTupleRegexpSelectTupleRegexpSelectTupleRegexpSelect supports the option 'invert_match'"invert_match""invert_match""invert_match""invert_match", which causes those input strings to be selected which do not match the regular expression.

For general information about string operations see Tuple / String Operations.

Exception: Empty input tuple

If the input tuple is empty, the operator returns an empty tuple.

HDevelop In-line Operation

HDevelop provides an in-line operation for tuple_regexp_selecttuple_regexp_selectTupleRegexpSelectTupleRegexpSelectTupleRegexpSelect, which can be used in an expression in the following syntax:

Selection := regexp_select(Data, Expression)

Execution Information

Parameters

DataDataDataDatadata (input_control)  string(-array) HTupleHTupleHtuple (string) (string) (HString) (char*)

Input strings to match.

ExpressionExpressionExpressionExpressionexpression (input_control)  string(-array) HTupleHTupleHtuple (string) (string) (HString) (char*)

Regular expression.

Default value: '.*' ".*" ".*" ".*" ".*"

Suggested values: '.*'".*"".*"".*"".*", 'invert_match'"invert_match""invert_match""invert_match""invert_match", 'ignore_case'"ignore_case""ignore_case""ignore_case""ignore_case", 'multiline'"multiline""multiline""multiline""multiline", 'dot_matches_all'"dot_matches_all""dot_matches_all""dot_matches_all""dot_matches_all", 'newline_lf'"newline_lf""newline_lf""newline_lf""newline_lf", 'newline_crlf'"newline_crlf""newline_crlf""newline_crlf""newline_crlf", 'newline_cr'"newline_cr""newline_cr""newline_cr""newline_cr"

SelectionSelectionSelectionSelectionselection (output_control)  string(-array) HTupleHTupleHtuple (string) (string) (HString) (char*)

Matching strings

Example (HDevelop)

tuple_regexp_select (['.','..','mydir','a.png','b.txt','c.bmp','d.dat'], \
                     '.(bmp|png)', Result)
* Returns ['a.png','c.bmp']

tuple_regexp_select (Files, ['training','invert_match'], Matches)
* Returns all file names that do *not* contain the string 'training'

Alternatives

tuple_selecttuple_selectTupleSelectTupleSelectTupleSelect

See also

tuple_regexp_matchtuple_regexp_matchTupleRegexpMatchTupleRegexpMatchTupleRegexpMatch, tuple_regexp_replacetuple_regexp_replaceTupleRegexpReplaceTupleRegexpReplaceTupleRegexpReplace, tuple_regexp_testtuple_regexp_testTupleRegexpTestTupleRegexpTestTupleRegexpTest

Module

Foundation


ClassesClasses | | Operators