Removing characters from a string? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
PepeLapiu
Posts: 324
Joined: 19 Jun 2020, 14:06

Removing characters from a string?

Post by PepeLapiu » 20 May 2022, 20:13

Guys.
I want to remove all the returns and new lines and replace them with a [#] instead in a string. In this case, the variable is clipboard. How would I do that?

PepeLapiu
Posts: 324
Joined: 19 Jun 2020, 14:06

Re: Removing characters from a string?

Post by PepeLapiu » 20 May 2022, 20:21

The following doesn't work for me. Why?

Code: Select all

RegExReplace(clipboard, `n `r, "#") 

User avatar
mikeyww
Posts: 26600
Joined: 09 Sep 2014, 18:38

Re: Removing characters from a string?  Topic is solved

Post by mikeyww » 20 May 2022, 20:21

Functions use expressions.

Code: Select all

Clipboard := StrReplace(Clipboard, "`n", "#")

Code: Select all

Clipboard := RegExReplace(Clipboard, "\R", "#")

Post Reply

Return to “Ask for Help (v1)”