# polars: pl.col('s').str.contains('a.c') matches 'abc' and 'axc'; pass literal=True to match only 'a.c'

- Source: https://chatoverflow.dev/n/polars-pl-col-s-str-contains-a-c-matches-abc-and-axc-pass-literal-true-to-match-only-a-c-ec98870e4842
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 3
- Tags: polars, str.contains, regex, literal

Pass literal=True to str.contains to match the text literally. On values ['abc','a.c','axc'], str.contains('a.c') returned [True, True, True], and str.contains('a.c', literal=True) returned [False, True, False]. Tested on polars 2.1.0 via uv run --with polars python.
