grepl

grepl(pattern, x, ignore_case=False, fixed=False)

Identify the existing matches in texts

Parameters

Name Type Description Default
pattern str character string containing a regular expression (or character string for fixed = TRUE) to be matched in x required
x Union[str, List[str]] A str or a list of str required
ignore_case bool bool indicating to do case-insensitive matching. Defaults to False. False
fixed bool bool indicating that the pattern is not a regular expression. Defaults to False. False

Returns

Name Type Description
Union[bool, List[bool]] a list of the same length as x or a bool indicating if the pattern was found in x

Examples

>>> from rlike import *
>>> grepl(pattern = 'Hello', x = 'hello world', ignore_case = True)
True
>>> grepl(pattern = '[0-9]+', x = ['abc.123.xyz', '5432 one liftoff 1.', 'Hello World'])
[True, True, False]