lang::util::get_regexp_indices (private)
lang::util::get_regexp_indices multilingual_string regexp_pattern
Defined in packages/acs-lang/tcl/lang-util-procs.tcl
Returns a list of two element lists containing the start and end indices of what is captured by the first parenthesis in the given regexp pattern in the multilingual string. The regexp pattern must follow the syntax of the expression argument to the Tcl regexp command. It must also contain exactly one capturing parenthesis for the pieces of text that indices are to be returned for.
- Parameters:
- multilingual_string (required)
- regexp_pattern (required)
- Author:
- Peter marklund <peter@collaboraid.biz>
- See Also:
- get_hash_indices
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set multilingual_string_offset "0" set offset_string $multilingual_string set indices_list [list] while { [regexp -indices $regexp_pattern $offset_string full_match_idx key_match_idx] } { lassign $key_match_idx start_idx end_idx lappend indices_list [list [expr {$multilingual_string_offset + $start_idx}] [expr {$multilingual_string_offset + $end_idx}]] set new_offset [expr {$end_idx + 1}] set multilingual_string_offset [expr {$multilingual_string_offset + $new_offset}] set offset_string [string range $offset_string $new_offset end] } return $indices_listXQL Not present: PostgreSQL, Oracle Generic XQL file: packages/acs-lang/tcl/lang-util-procs.xql