Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions source/isaaclab/isaaclab/utils/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,18 +280,18 @@ def resolve_matching_names_values(
"""Match a list of regular expressions in a dictionary against a list of strings and return
the matched indices, names, and values.

If the :attr:`preserve_order` is True, the ordering of the matched indices and names is the same as the order
of the provided list of strings. This means that the ordering is dictated by the order of the target strings
and not the order of the query regular expressions.
If the :attr:`preserve_order` is False (default), the ordering of the matched indices and names follows
the order of the provided list of strings. This means that the ordering is dictated by the order of the
target strings and not the order of the query regular expressions.

If the :attr:`preserve_order` is False, the ordering of the matched indices and names is the same as the order
of the provided list of query regular expressions.
If the :attr:`preserve_order` is True, the ordering of the matched indices and names follows the order
of the query regular expressions (i.e., the keys in the data dictionary).

For example, consider the dictionary is {"a|d|e": 1, "b|c": 2}, the list of strings is ['a', 'b', 'c', 'd', 'e'].
If :attr:`preserve_order` is False, then the function will return the indices of the matched strings, the
matched strings, and the values as: ([0, 1, 2, 3, 4], ['a', 'b', 'c', 'd', 'e'], [1, 2, 2, 1, 1]). When
:attr:`preserve_order` is True, it will return them as:
([0, 3, 4, 1, 2], ['a', 'd', 'e', 'b', 'c'], [1, 1, 1, 2, 2]).
If :attr:`preserve_order` is False (default), then the function will return the indices of the matched strings,
the matched strings, and the values as: ([0, 1, 2, 3, 4], ['a', 'b', 'c', 'd', 'e'], [1, 2, 2, 1, 1]) - following
the order of list_of_strings. When :attr:`preserve_order` is True, it will return them as:
([0, 3, 4, 1, 2], ['a', 'd', 'e', 'b', 'c'], [1, 1, 1, 2, 2]) - following the order of the regex keys in data.

Args:
data: A dictionary of regular expressions and values to match the strings in the list.
Expand Down