otp.Operation.str.match#

match(pat, case=True)#

Match the text against a regular expression specified in the pat parameter.

Parameters
  • pat (str) – A pattern specified via the POSIX extended regular expression syntax

  • case (Bool) – If True, case sensitive.

Returns

1.0 if the match was successful, 0.0 otherwise.

Return type

Operation

Examples

>>> data = otp.Ticks(X=["hello", "there were 77 ticks"])
>>> data['Y'] = data['X'].str.match('\d\d')
>>> otp.run(data)
                     Time                    X    Y
0 2003-12-01 00:00:00.000                hello  0.0
1 2003-12-01 00:00:00.001  there were 77 ticks  1.0