larray.Axis.matching¶
-
Axis.matching(pattern)[source]¶ 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
>>> people = Axis(['Bruce Wayne', 'Bruce Willis', 'Waldo', 'Arthur Dent', 'Harvey Dent'], 'people')
All labels starting with “W” and ending with “o” are given by
>>> people.matching('W.*o') people['Waldo']
All labels not containing character “a”
>>> people.matching('[^a]*$') people['Bruce Willis', 'Arthur Dent']