text_extensions_for_pandas/spanner/extract.py
def extract_regex(
    doc_text: str,
    compiled_regex: "re.Pattern"  # Double quotes for Python 3.6 compatibility
):
    """
    Identify all non-overlapping matches of a regular expression, as returned by
    ``re.Pattern.finditer()``, and return those locations as an array of spans.

    :param doc_text: Text of the document; will be the target text of the returned spans.

    :param compiled_regex: Regular expression to evaluate, compiled with either the ``re``
      or the ``regex`` package.

    :returns: A ``SpanArray`` containing a span for each match of the regex.
    """
    begins = []
    ends = []
    for a in compiled_regex.finditer(doc_text):
        begins.append(a.start())
        ends.append(a.end())

    return SpanArray(doc_text, begins, ends)

    Identify all non-overlapping matches of a regular expression, as returned by
    ``re.Pattern.finditer()``, and return those locations as an array of spans.

    :param doc_text: Text of the document; will be the target text of the returned spans.

    :param compiled_regex: Regular expression to evaluate, compiled with either the ``re``
      or the ``regex`` package.

    :returns: A ``SpanArray`` containing a span for each match of the regex.
    
Identify all non-overlapping matches of a regular expression, as returned by
``re.Pattern.finditer()``, and return those locations as an array of spans.
Identify all non - overlapping matches of a regular expression as returned by ` ` re . Pattern . finditer () ` ` and return those locations as an array of spans .
def extract_regex(
    doc_text: str,
    compiled_regex: "re.Pattern"  
):
    begins = []
    ends = []
    for a in compiled_regex.finditer(doc_text):
        begins.append(a.start())
        ends.append(a.end())
    return SpanArray(doc_text, begins, ends)
def extract_regex ( doc_text : str , compiled_regex : "re.Pattern" ) : begins = [ ] ends = [ ] for a in compiled_regex . finditer ( doc_text ) : begins . append ( a . start ( ) ) ends . append ( a . end ( ) ) return SpanArray ( doc_text , begins , ends )
Identify all non-overlapping matches of a regular expression, as returned by
``re.Pattern.finditer()``, and return those locations as an array of spans.
Identify all non - overlapping matches of a regular expression as returned by ` ` re . Pattern . finditer () ` ` and return those locations as an array of spans .
# Double quotes for Python 3.6 compatibility """
    Identify all non-overlapping matches of a regular expression, as returned by
    ``re.Pattern.finditer()``, and return those locations as an array of spans.

    :param doc_text: Text of the document; will be the target text of the returned spans.

    :param compiled_regex: Regular expression to evaluate, compiled with either the ``re``
      or the ``regex`` package.

    :returns: A ``SpanArray`` containing a span for each match of the regex.
    """
A ``SpanArray`` containing a span for each match of the regex.
A ` ` SpanArray ` ` containing a span for each match of the regex .
doc_text
str
Text of the document; will be the target text of the returned spans.
Text of the document ; will be the target text of the returned spans .
compiled_regex
"re.Pattern"
Regular expression to evaluate, compiled with either the ``re``
or the ``regex`` package.
Regular expression to evaluate compiled with either the ` ` re ` ` or the ` ` regex ` ` package .