tuple_regexp_selecttuple_regexp_selectTupleRegexpSelectTupleRegexpSelect (Operator)

Name

tuple_regexp_selecttuple_regexp_selectTupleRegexpSelectTupleRegexpSelect — Auswählen von Tupelelementen, die einem regulären Ausdruck entsprechen.

Signatur

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)

Beschreibung

tuple_regexp_selecttuple_regexp_selectTupleRegexpSelectTupleRegexpSelectTupleRegexpSelect wendet den regulären Ausdruck ExpressionExpressionExpressionExpressionexpression auf eine oder mehrere Zeichenketten in DataDataDataDatadata an, und gibt die Elemente, die eine dem Suchmuster entsprechende Teilzeichenkette enthalten, in SelectionSelectionSelectionSelectionselection zurück. Dies ist ein bequemer Weg, um z.B. ein über den Operator list_fileslist_filesListFilesListFilesListFiles erhaltenes Tupel von Dateinamen zu filtern.

Für die Beschreibung von Syntax und Optionen des regulären Ausdrucks wird auf die Dokumentation des Operators tuple_regexp_matchtuple_regexp_matchTupleRegexpMatchTupleRegexpMatchTupleRegexpMatch verwiesen. Zusätzlich unterstützt der Operator tuple_regexp_testtuple_regexp_testTupleRegexpTestTupleRegexpTestTupleRegexpTest noch die Option 'invert_match'"invert_match""invert_match""invert_match""invert_match", mit der die Elemente ausgewählt werden, die dem Suchmuster nicht entsprechen.

Für allgemeine Informationen zu String-Operationen siehe auch Tupel / String-Operationen.

Falls das Eingabetupel leer ist, gibt der Operator ein leeres Tupel zurück.

Unicode Codepoints versus Bytes

Die Auswertung der regulären Ausdrücke berücksichtigt Unicode Codepoints. Ein Codepoint kann aus mehreren Bytes im UTF-8 String zusammengesetzt sein. Wenn die Auswertung der regulären Ausdrücke sich auf die Bytes des Strings beziehen soll, kann dieser Operator mit set_system('tsp_tuple_string_operator_mode', 'byte')set_system("tsp_tuple_string_operator_mode", "byte")SetSystem("tsp_tuple_string_operator_mode", "byte")SetSystem("tsp_tuple_string_operator_mode", "byte")SetSystem("tsp_tuple_string_operator_mode", "byte") in einen Byte-Modus umgeschaltet werden. Wenn 'filename_encoding'"filename_encoding""filename_encoding""filename_encoding""filename_encoding" auf 'locale'"locale""locale""locale""locale" gesetzt ist (legacy), verwendet dieser Operator immer den Byte-Modus.

HDevelop Inline-Operation

HDevelop unterstützt eine Inline-Operation für tuple_regexp_selecttuple_regexp_selectTupleRegexpSelectTupleRegexpSelectTupleRegexpSelect, die innerhalb eines Ausdrucks in der folgenden Syntax verwendet werden kann:

Selection := regexp_select(Data, Expression)

Ausführungsinformationen

Parameter

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

Eingabezeichenketten, auf die das Suchmuster angewendet wird

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

Regulärer Ausdruck.

Defaultwert: '.*' ".*" ".*" ".*" ".*"

Wertevorschläge: '.*'".*"".*"".*"".*", '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*)

Zeichenketten mit Übereinstimmung

Beispiel (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'

Alternativen

tuple_selecttuple_selectTupleSelectTupleSelectTupleSelect

Siehe auch

tuple_regexp_matchtuple_regexp_matchTupleRegexpMatchTupleRegexpMatchTupleRegexpMatch, tuple_regexp_replacetuple_regexp_replaceTupleRegexpReplaceTupleRegexpReplaceTupleRegexpReplace, tuple_regexp_testtuple_regexp_testTupleRegexpTestTupleRegexpTestTupleRegexpTest

Modul

Foundation