class_docstr: Uses rules to match a set of regular expressions and associate them with a
  provided identifier.
  
  A rule consists of a regex pattern and an identifier, delimited by a character of
  choice. An example could be `"\d{4}\/\d\d\/\d\d,date"` which will match
  strings like `"1970/01/01"` to the identifier `"date"`.
  
  Rules must be provided by either :meth:`.setRules` (followed by
  :meth:`.setDelimiter`) or an external file.
  
  To use an external file, a dictionary of predefined regular expressions must be
  provided with :meth:`.setExternalRules`. The dictionary can be set in the form of a
  delimited text file.
  
  Pretrained pipelines are available for this module, see `Pipelines
  <https://sparknlp.org/docs/en/pipelines>`__.
  
  For extended examples of usage, see the `Examples
  <https://github.com/JohnSnowLabs/spark-nlp/blob/master/examples/python/annotation/text/english/regex-matcher/Matching_Text_with_RegexMatcher.ipynb>`__.
  
  ====================== ======================
  Input Annotation types Output Annotation type
  ====================== ======================
  ``DOCUMENT``           ``CHUNK``
  ====================== ======================
  
  Parameters
  ----------
  strategy
      Can be either MATCH_FIRST|MATCH_ALL|MATCH_COMPLETE, by default
      "MATCH_ALL"
  rules
      Regex rules to match the identifier with
  delimiter
      Delimiter for rules provided with setRules
  externalRules
      external resource to rules, needs 'delimiter' in options
  
  Examples
  --------
  >>> import sparknlp
  >>> from sparknlp.base import *
  >>> from sparknlp.annotator import *
  >>> from pyspark.ml import Pipeline
  
  In this example, the ``rules.txt`` has the form of::
  
      the\s\w+, followed by 'the'
      ceremonies, ceremony
  
  where each regex is separated by the identifier ``","``
  
  >>> documentAssembler = DocumentAssembler().setInputCol("text").setOutputCol("document")
  >>> sentence = SentenceDetector().setInputCols(["document"]).setOutputCol("sentence")
  >>> regexMatcher = RegexMatcher() \
  ...     .setExternalRules("src/test/resources/regex-matcher/rules.txt",  ",") \
  ...     .setInputCols(["sentence"]) \
  ...     .setOutputCol("regex") \
  ...     .setStrategy("MATCH_ALL")
  >>> pipeline = Pipeline().setStages([documentAssembler, sentence, regexMatcher])
  >>> data = spark.createDataFrame([[
  ...     "My first sentence with the first rule. This is my second sentence with ceremonies rule."
  ... ]]).toDF("text")
  >>> results = pipeline.fit(data).transform(data)
  >>> results.selectExpr("explode(regex) as result").show(truncate=False)
  +--------------------------------------------------------------------------------------------+
  |result                                                                                      |
  +--------------------------------------------------------------------------------------------+
  |[chunk, 23, 31, the first, [identifier -> followed by 'the', sentence -> 0, chunk -> 0], []]|
  |[chunk, 71, 80, ceremonies, [identifier -> ceremony, sentence -> 1, chunk -> 0], []]        |
  +--------------------------------------------------------------------------------------------+
docstr: Sets matching strategy, by default "MATCH_ALL".
  
  Can be either MATCH_FIRST|MATCH_ALL|MATCH_COMPLETE.
  
  Parameters
  ----------
  value : str
      Matching Strategy
code: def setStrategy(self, value):
      """Sets matching strategy, by default "MATCH_ALL".
  
      Can be either MATCH_FIRST|MATCH_ALL|MATCH_COMPLETE.
  
      Parameters
      ----------
      value : str
          Matching Strategy
      """
      return self._set(strategy=value)
  
file_path: spark-nlp/python/sparknlp/annotator/matcher/regex_matcher.py
imports: from sparknlp.common import *
label_desc: Use image node_id 2 for calling the RegexMatcher obj's underlying member method code with example usage: obj.setStrategy(value) and returns: self