# 1.1. Module Functions

`jsre.``compile`(pattern, **kargs)

  Compile a regular expression into a regular expression object.

  Is equivalent to RECompile(...).compile()

  `pattern --- A regular expression, in str format. (bytes are not an option)`
  Keywords:
    encoding, flags, stride, offset – See ReCompile()

`jsre.``search`(pattern, target, **kargs)

  Find the first match location of a pattern in the target.

  Regular expressions and encodings are searched in turn and search will halt at the first to match. If multiple res and encodings are specified then ‘first’ may not be the smallest index that could be matched by any of the possible encodings.

  The module level functions search, finditer, findall allow the target (the data to be searched) to be either bytes or str. The str option is not the intended use of this regular expression engine and is provided only for compatibility with other re - normally only for experiment and testing. If a string target is presented it is encoded using utf32 then searched; any indexes returned from the match function (start, end) will index the original string search target.

  Regular epxressions and associated encodings are cached - if the same combination is quested at module level the execution engine is not rebuilt.

  Parameters: | --- The regular expression, as a str (pattern) – --- The search target, as a byte buffer or str (see above) (target) –

  Keywords:
    encoding, flags, stride, offset – See ReCompile()

  Returns: | match — A match object.

`jsre.``findall`(pattern, target, **kargs)

  Returns all search hits as a list of strings, or if multiple matches a list of tuples.

  For arguments and keywords, see search()

`jsre.``finditer`(pattern, target, **kargs)

  Returns a match iterator for the regular expression pattern over the search target.

  For arguments and keywords, see search()