Detail: IndexMillisecond: Accessor Regular Expression

Overview: IndexMillisecond: Accessor Regular Expression

IndexMillisecond.via_re(pattern, flags).search(pos, endpos)
via_re = <function Index.via_re>
InterfaceRe.search(pos=0, endpos=None)[source]

Scan through string looking for the first location where this regular expression produces a match and return True, else False. Note that this is different from finding a zero-length match at some point in the string.

Parameters
  • pos – Gives an index in the string where the search is to start; it defaults to 0.

  • endpos – Limits how far the string will be searched; it will be as if the string is endpos characters long.

>>> ix = sf.IndexMillisecond(('1517-04-01', '1517-12-31', '1517-06-30'))
>>> ix
<IndexMillisecond>
1517-04-01T00:00:00.000
1517-12-31T00:00:00.000
1517-06-30T00:00:00.000
<datetime64[ms]>
>>> ix.via_re('[X123]').search()
[ True  True  True]
IndexMillisecond.via_re(pattern, flags).match(pos, endpos)
via_re = <function Index.via_re>
InterfaceRe.match(pos=0, endpos=None)[source]

If zero or more characters at the beginning of string match this regular expression return True, else False. Note that this is different from a zero-length match.

Parameters
  • pos – Gives an index in the string where the search is to start; it defaults to 0.

  • endpos – Limits how far the string will be searched; it will be as if the string is endpos characters long.

>>> ix = sf.IndexMillisecond(('1517-04-01', '1517-12-31', '1517-06-30'))
>>> ix
<IndexMillisecond>
1517-04-01T00:00:00.000
1517-12-31T00:00:00.000
1517-06-30T00:00:00.000
<datetime64[ms]>
>>> ix.via_re('[X123]').match()
[ True  True  True]
IndexMillisecond.via_re(pattern, flags).fullmatch(pos, endpos)
via_re = <function Index.via_re>
InterfaceRe.fullmatch(pos=0, endpos=None)[source]

If the whole string matches this regular expression, return True, else False. Note that this is different from a zero-length match.

Parameters
  • pos – Gives an index in the string where the search is to start; it defaults to 0.

  • endpos – Limits how far the string will be searched; it will be as if the string is endpos characters long.

>>> ix = sf.IndexMillisecond(('1517-04-01', '1517-12-31', '1517-06-30'))
>>> ix
<IndexMillisecond>
1517-04-01T00:00:00.000
1517-12-31T00:00:00.000
1517-06-30T00:00:00.000
<datetime64[ms]>
>>> ix.via_re('123').fullmatch()
[False False False]
IndexMillisecond.via_re(pattern, flags).split(maxsplit)
via_re = <function Index.via_re>
InterfaceRe.split(maxsplit=0)[source]

Split string by the occurrences of pattern. If capturing parentheses are used in pattern, then the text of all groups in the pattern are also returned as part of the resulting tuple.

Parameters

maxsplit – If nonzero, at most maxsplit splits occur, and the remainder of the string is returned as the final element of the tuple.

>>> ix = sf.IndexMillisecond(('1517-04-01', '1517-12-31', '1517-06-30'))
>>> ix
<IndexMillisecond>
1517-04-01T00:00:00.000
1517-12-31T00:00:00.000
1517-06-30T00:00:00.000
<datetime64[ms]>
>>> ix.via_re('[X123]').split()
[('', '5', '7-04-0', 'T00:00:00.000')
 ('', '5', '7-', '', '-', '', 'T00:00:00.000')
 ('', '5', '7-06-', '0T00:00:00.000')]
IndexMillisecond.via_re(pattern, flags).findall(pos, endpos)
via_re = <function Index.via_re>
InterfaceRe.findall(pos=0, endpos=None)[source]

Return all non-overlapping matches of pattern in string, as a tuple of strings. The string is scanned left-to-right, and matches are returned in the order found. If one or more groups are present in the pattern, return a tuple of groups; this will be a tuple of tuples if the pattern has more than one group. Empty matches are included in the result.

Parameters
  • pos – Gives an index in the string where the search is to start; it defaults to 0.

  • endpos – Limits how far the string will be searched; it will be as if the string is endpos characters long.

>>> ix = sf.IndexMillisecond(('1517-04-01', '1517-12-31', '1517-06-30'))
>>> ix
<IndexMillisecond>
1517-04-01T00:00:00.000
1517-12-31T00:00:00.000
1517-06-30T00:00:00.000
<datetime64[ms]>
>>> ix.via_re('[X123]').findall()
[('1', '1', '1') ('1', '1', '1', '2', '3', '1') ('1', '1', '3')]
IndexMillisecond.via_re(pattern, flags).sub(repl, count)
via_re = <function Index.via_re>
InterfaceRe.sub(repl, count=0)[source]

Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl. If the pattern is not found, the string is returned unchanged.

Parameters
  • repl – A string or a function; if it is a string, any backslash escapes in it are processed.

  • count – The optional argument count is the maximum number of pattern occurrences to be replaced; count must be a non-negative integer. If omitted or zero, all occurrences will be replaced.

>>> ix = sf.IndexMillisecond(('1517-04-01', '1517-12-31', '1517-06-30'))
>>> ix
<IndexMillisecond>
1517-04-01T00:00:00.000
1517-12-31T00:00:00.000
1517-06-30T00:00:00.000
<datetime64[ms]>
>>> ix.via_re('[X123]').sub('==')
['==5==7-04-0==T00:00:00.000' '==5==7-====-====T00:00:00.000'
 '==5==7-06-==0T00:00:00.000']
IndexMillisecond.via_re(pattern, flags).subn(repl, count)
via_re = <function Index.via_re>
InterfaceRe.subn(repl, count=0)[source]

Perform the same operation as sub(), but return a tuple (new_string, number_of_subs_made).

Parameters
  • repl – A string or a function; if it is a string, any backslash escapes in it are processed.

  • count – The optional argument count is the maximum number of pattern occurrences to be replaced; count must be a non-negative integer. If omitted or zero, all occurrences will be replaced.

>>> ix = sf.IndexMillisecond(('1517-04-01', '1517-12-31', '1517-06-30'))
>>> ix
<IndexMillisecond>
1517-04-01T00:00:00.000
1517-12-31T00:00:00.000
1517-06-30T00:00:00.000
<datetime64[ms]>
>>> ix.via_re('[X123]').subn('==', 1)
[('==517-04-01T00:00:00.000', 1) ('==517-12-31T00:00:00.000', 1)
 ('==517-06-30T00:00:00.000', 1)]

IndexMillisecond: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Iterator | Operator Binary | Operator Unary | Accessor Values | Accessor Datetime | Accessor String | Accessor Regular Expression