Callables.with_name_regex()

with_name_regex(regex: str) → Callables

Adds a filter to get callables whose names match the given regex expression. Returns a filtered Callables child object. This method can be called on all Callables child classes: Functions and Modifiers.

To filter given a list of regex expression, refer to Callables.with_name_regexes().

Functions Example

from glider import *

def query():
  # Retrieve the functions that have `claim` in their name but do not start with `_`
  functions = Functions().with_name_regex(r"^(?!_).*claim.*$").exec(100)

  # Return the first five functions
  return functions[:1]

Output:

Modifiers Example

from glider import *

def query():
  # Retrieve the modifiers that have `claim` in their name but do not start with `only`
  modifiers = Modifiers().with_name_regex(r"^(?!only).*claim.*$").exec(100)

  # Return the first five modifiers
  return modifiers[:3]

Output:

Last updated