class_docstr: Namespace for string related expressions.
class_docstr_tok: ["Namespace","for","string","related","expressions","."]
docstr: Extract the target capture group from provided patterns.
  
  Parameters
  ----------
  pattern
      A valid regular expression pattern, compatible with the `regex crate
      <https://docs.rs/regex/latest/regex/>`_.
  group_index
      Index of the targeted capture group.
      Group 0 means the whole pattern, the first group begins at index 1.
      Defaults to the first capture group.
  
  Notes
  -----
  To modify regular expression behaviour (such as multi-line matching)
  with flags, use the inline `(?iLmsuxU)` syntax. For example:
  
  >>> df = pl.DataFrame(
  ...     data={
  ...         "lines": [
  ...             "I Like\nThose\nOdds",
  ...             "This is\nThe Way",
  ...         ]
  ...     }
  ... )
  >>> df.with_columns(
  ...     pl.col("lines").str.extract(r"(?m)^(T\w+)", 1).alias("matches"),
  ... )
  shape: (2, 2)
  ┌─────────┬─────────┐
  │ lines   ┆ matches │
  │ ---     ┆ ---     │
  │ str     ┆ str     │
  ╞═════════╪═════════╡
  │ I Like  ┆ Those   │
  │ Those   ┆         │
  │ Odds    ┆         │
  │ This is ┆ This    │
  │ The Way ┆         │
  └─────────┴─────────┘
  
  See the regex crate's section on `grouping and flags
  <https://docs.rs/regex/latest/regex/#grouping-and-flags>`_ for
  additional information about the use of inline expression modifiers.
  
  Returns
  -------
  Expr
      Expression of data type :class:`String`. Contains null values if original
      value is null or the regex captures nothing.
  
  Examples
  --------
  >>> df = pl.DataFrame(
  ...     {
  ...         "url": [
  ...             "http://vote.com/ballon_dor?error=404&ref=unknown",
  ...             "http://vote.com/ballon_dor?ref=polars&candidate=messi",
  ...             "http://vote.com/ballon_dor?candidate=ronaldo&ref=polars",
  ...         ]
  ...     }
  ... )
  >>> df.select(
  ...     pl.col("url").str.extract(r"candidate=(\w+)", 1).alias("candidate"),
  ...     pl.col("url").str.extract(r"ref=(\w+)", 1).alias("referer"),
  ...     pl.col("url").str.extract(r"error=(\w+)", 1).alias("error"),
  ... )
  shape: (3, 3)
  ┌───────────┬─────────┬───────┐
  │ candidate ┆ referer ┆ error │
  │ ---       ┆ ---     ┆ ---   │
  │ str       ┆ str     ┆ str   │
  ╞═══════════╪═════════╪═══════╡
  │ null      ┆ unknown ┆ 404   │
  │ messi     ┆ polars  ┆ null  │
  │ ronaldo   ┆ polars  ┆ null  │
  └───────────┴─────────┴───────┘
docstr_tok: ["Extract","the","target","capture","group","from","provided","patterns",".","Parameters","--","--","--","--","--","pattern","A","valid","regular","expression","pattern",",","compatible","with","the","`","regex","crate","<","https",":","\/\/docs.rs\/regex\/latest\/regex\/",">","`","_",".","group_index","Index","of","the","targeted","capture","group",".","Group","0","means","the","whole","pattern",",","the","first","group","begins","at","index","1",".","Defaults","to","the","first","capture","group",".","Notes","--","--","-","To","modify","regular","expression","behaviour","(","such","as","multi-line","matching",")","with","flags",",","use","the","inline","`","(","?","iLmsuxU",")","`","syntax",".","For","example",":",">",">",">","df","=","pl.DataFrame","(","...","data=","{","...","``","lines","''",":","[","...","``","I","Like\\nThose\\nOdds","''",",","...","``","This","is\\nThe","Way","''",",","...","]","...","}","...",")",">",">",">","df.with_columns","(","...","pl.col","(","``","lines","''",")",".str.extract","(","r","''","(","?","m",")","^","(","T\\w+",")","''",",","1",")",".alias","(","``","matches","''",")",",","...",")","shape",":","(","2",",","2",")","\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510","\u2502","lines","\u2506","matches","\u2502","\u2502","--","-","\u2506","--","-","\u2502","\u2502","str","\u2506","str","\u2502","\u255e\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2561","\u2502","I","Like","\u2506","Those","\u2502","\u2502","Those","\u2506","\u2502","\u2502","Odds","\u2506","\u2502","\u2502","This","is","\u2506","This","\u2502","\u2502","The","Way","\u2506","\u2502","\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518","See","the","regex","crate","'s","section","on","`","grouping","and","flags","<","https",":","\/\/docs.rs\/regex\/latest\/regex\/","#","grouping-and-flags",">","`","_","for","additional","information","about","the","use","of","inline","expression","modifiers",".","Returns","--","--","--","-","Expr","Expression","of","data","type",":","class",":","`","String","`",".","Contains","null","values","if","original","value","is","null","or","the","regex","captures","nothing",".","Examples","--","--","--","--",">",">",">","df","=","pl.DataFrame","(","...","{","...","``","url","''",":","[","...","``","http",":","\/\/vote.com\/ballon_dor","?","error=404","&","ref=unknown","''",",","...","``","http",":","\/\/vote.com\/ballon_dor","?","ref=polars","&","candidate=messi","''",",","...","``","http",":","\/\/vote.com\/ballon_dor","?","candidate=ronaldo","&","ref=polars","''",",","...","]","...","}","...",")",">",">",">","df.select","(","...","pl.col","(","``","url","''",")",".str.extract","(","r","''","candidate=","(","\\w+",")","''",",","1",")",".alias","(","``","candidate","''",")",",","...","pl.col","(","``","url","''",")",".str.extract","(","r","''","ref=","(","\\w+",")","''",",","1",")",".alias","(","``","referer","''",")",",","...","pl.col","(","``","url","''",")",".str.extract","(","r","''","error=","(","\\w+",")","''",",","1",")",".alias","(","``","error","''",")",",","...",")","shape",":","(","3",",","3",")","\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510","\u2502","candidate","\u2506","referer","\u2506","error","\u2502","\u2502","--","-","\u2506","--","-","\u2506","--","-","\u2502","\u2502","str","\u2506","str","\u2506","str","\u2502","\u255e\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2561","\u2502","null","\u2506","unknown","\u2506","404","\u2502","\u2502","messi","\u2506","polars","\u2506","null","\u2502","\u2502","ronaldo","\u2506","polars","\u2506","null","\u2502","\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"]
code: def extract(self, pattern: str, group_index: int = 1) -> Expr:
      r"""
      Extract the target capture group from provided patterns.
  
      Parameters
      ----------
      pattern
          A valid regular expression pattern, compatible with the `regex crate
          <https://docs.rs/regex/latest/regex/>`_.
      group_index
          Index of the targeted capture group.
          Group 0 means the whole pattern, the first group begins at index 1.
          Defaults to the first capture group.
  
      Notes
      -----
      To modify regular expression behaviour (such as multi-line matching)
      with flags, use the inline `(?iLmsuxU)` syntax. For example:
  
      >>> df = pl.DataFrame(
      ...     data={
      ...         "lines": [
      ...             "I Like\nThose\nOdds",
      ...             "This is\nThe Way",
      ...         ]
      ...     }
      ... )
      >>> df.with_columns(
      ...     pl.col("lines").str.extract(r"(?m)^(T\w+)", 1).alias("matches"),
      ... )
      shape: (2, 2)
      ┌─────────┬─────────┐
      │ lines   ┆ matches │
      │ ---     ┆ ---     │
      │ str     ┆ str     │
      ╞═════════╪═════════╡
      │ I Like  ┆ Those   │
      │ Those   ┆         │
      │ Odds    ┆         │
      │ This is ┆ This    │
      │ The Way ┆         │
      └─────────┴─────────┘
  
      See the regex crate's section on `grouping and flags
      <https://docs.rs/regex/latest/regex/#grouping-and-flags>`_ for
      additional information about the use of inline expression modifiers.
  
      Returns
      -------
      Expr
          Expression of data type :class:`String`. Contains null values if original
          value is null or the regex captures nothing.
  
      Examples
      --------
      >>> df = pl.DataFrame(
      ...     {
      ...         "url": [
      ...             "http://vote.com/ballon_dor?error=404&ref=unknown",
      ...             "http://vote.com/ballon_dor?ref=polars&candidate=messi",
      ...             "http://vote.com/ballon_dor?candidate=ronaldo&ref=polars",
      ...         ]
      ...     }
      ... )
      >>> df.select(
      ...     pl.col("url").str.extract(r"candidate=(\w+)", 1).alias("candidate"),
      ...     pl.col("url").str.extract(r"ref=(\w+)", 1).alias("referer"),
      ...     pl.col("url").str.extract(r"error=(\w+)", 1).alias("error"),
      ... )
      shape: (3, 3)
      ┌───────────┬─────────┬───────┐
      │ candidate ┆ referer ┆ error │
      │ ---       ┆ ---     ┆ ---   │
      │ str       ┆ str     ┆ str   │
      ╞═══════════╪═════════╪═══════╡
      │ null      ┆ unknown ┆ 404   │
      │ messi     ┆ polars  ┆ null  │
      │ ronaldo   ┆ polars  ┆ null  │
      └───────────┴─────────┴───────┘
  
      """
      return wrap_expr(self._pyexpr.str_extract(pattern, group_index))
  
imports: from __future__ import annotations
  import warnings
  from typing import TYPE_CHECKING
  import polars._reexport
  from polars import functions
  from polars.datatypes import Date, Datetime, Int32, Time, py_type_to_dtype
  from polars.exceptions import ChronoFormatWarning
  from polars.utils._parse_expr_input import parse_as_expression
  from polars.utils._wrap import wrap_expr
  from polars.utils.deprecation import deprecate_renamed_function, deprecate_renamed_parameter, rename_use_earliest_to_ambiguous
  from polars.utils.various import find_stacklevel
label_desc: Use image node_id 28 for calling the ExprStringNameSpace obj's underlying member method code with example usage: obj.extract(pattern, group_index) and returns: wrap_expr