Swapping parts of a string

Let’s talk about one of the common regex task that they are extremely good at: swapping string parts. See how capturing groups and backreferences make it an easy job. R code demo included. REGEX FIDDLE: FURTHER LINKS: - Suffix to prefix and prefix to suffix in R: - Swap groups in Python: - Swap text around a character (Notepad ): - Sed: How to swap only numeric values in each line: - Replacing strings tutorial:
Back to Top