wxRegEx

wxRegEx

Creation Parameters

For more information, see the on-line wxWidgets documentation:

Functions/Procedures
Supertopics

wxRegEx

[func]
compile_regex
(atom regex, sequence pattern, integer flags)

Category: wxRegEx

Create and compile the regular expression, use is_valid_regex to test for compilation errors.


wxRegEx

[proc]
delete_wxRegEx
( object obj )

Category: wxRegEx

Deletes a wxRegEx object.


wxRegEx

[func]
get_match
( atom regex, sequence text, integer index )

Category: wxRegEx

Get the start index and the length of the match of the expression (if index is 0) or a bracketed subexpression (index different from 0).

May only be called after successful call to Matches() and only if wxRE_NOSUB was not used in compile_regex.

Returns false if no match or if an error occurred.


wxRegEx

[func]
get_match_count
( atom regex )

Category: wxRegEx

Returns the size of the array of matches, i.e. the number of bracketed subexpressions plus one for the expression itself, or 0 on error.

May only be called after successful call to Compile(). and only if wxRE_NOSUB was not used.


wxRegEx

[func]
is_valid_regex
( atom regex )

Category: wxRegEx

Return 1 if this is a valid compiled regular expression, 0 otherwise.


wxRegEx

[func]
regex_matches
( atom regex, sequence text, integer flags )

Category: wxRegEx

Matches the precompiled regular expression against the string text, returns true if matches and false otherwise.

Flags may be combination of wxRE_NOTBOL and wxRE_NOTEOL.

May only be called after successful call to compile_regex.


wxRegEx

[func]
replace_regex
( atom regex, sequence text, sequence replacement, integer max_matches, integer in_place )

Category: wxRegEx

Replaces the current regular expression in the string pointed to by text, with the text in replacement. If in_place is 1, then only the modified text is returned. If in_place is 1, then the return value is a sequence, with the first element the number of replaces made, and the second element the modified text.

The replacement text may contain back references \number which will be replaced with the value of the corresponding subexpression in the pattern match. \0 corresponds to the entire match and & is a synonym for it. Backslash may be used to quote itself or & character.

max_matches may be used to limit the number of replacements made, setting it to 1, for example, will only replace first occurrence (if any) of the pattern in the text while default value of 0 means replace all.