larray.IGroup.matching

IGroup.matching(pattern)

Returns a group with all the labels matching the specified pattern (regular expression).

Parameters:

pattern : str or Group

Regular expression (regex).

Returns:

LGroup

Group containing all the labels matching the pattern.

Notes

See Regular Expression for more details about how to build a pattern.

Examples

>>> from larray import Axis
>>> people = Axis(['Bruce Wayne', 'Bruce Willis', 'Arthur Dent'], 'people')

All labels containing “B” and “e” with exactly 3 characters in between are given by

>>> group = people.matching('B...e')
>>> group
people['Bruce Wayne', 'Bruce Willis']

Within that group, all labels containing any characters then W then any characters then s are given by >>> group.matching(‘.*W.*s’) people[‘Bruce Willis’]