Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regex replace should mention $ escaping is only for substitution #19527

Closed
orlp opened this issue Oct 30, 2024 · 1 comment · Fixed by #19529
Closed

Regex replace should mention $ escaping is only for substitution #19527

orlp opened this issue Oct 30, 2024 · 1 comment · Fixed by #19529
Labels
accepted Ready for implementation documentation Improvements or additions to documentation

Comments

@orlp
Copy link
Collaborator

orlp commented Oct 30, 2024

Description

The docs for Expr.str.replace should be improved, they are confusing because they state the following:

The dollar sign ($) is a special character related to capture groups. To refer to a literal dollar sign, use $$ instead or set literal to True.

This only applies to the replacement, not the pattern. In a pattern $ must be escaped using a backslash: "\\$". This was confusing for this user: #19523.

Link

https://docs.pola.rs/api/python/stable/reference/expressions/api/polars.Expr.str.replace.html

@orlp orlp added documentation Improvements or additions to documentation accepted Ready for implementation labels Oct 30, 2024
@github-project-automation github-project-automation bot moved this to Ready in Backlog Oct 30, 2024
@alexander-beedie
Copy link
Collaborator

Yup; almost finished an update for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation documentation Improvements or additions to documentation
Projects
Archived in project
2 participants