Regular expressions pcre2 · Using regex in tools
Replace in Python
Replace matches using a pattern and a replacement, with \1 style references.
re.sub(r"(\d{4})-(\d{2})-(\d{2})", r"\3/\2/\1", text)
Official Regular expressions pcre2 documentation
More using regex in tools commands
- Search with grep
- Use lookarounds with grep
- Rewrite text with sed
- Match in JavaScript
- Replace in JavaScript
- Find all matches in Python
All using regex in tools commands · Regular expressions pcre2 cheatsheet