Removing certain characters from a list

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
hihixd
Posts: 6
Joined: 08 Aug 2020, 22:13

Removing certain characters from a list

21 Jun 2021, 12:40

Hi there,
I have a list of items that resembles this (If it was this short I'd do it by hand but its way longer.)

- [x] bhop_4appa_hdr
- [x] bhop_620s_hdr
- [x] bhop_behemoth
- [ ] bhop_grove_hdr
- [ ] bhop_linear_gif2
- [x] bhop_magic_cave

It is from gitlab and I need to copy it somewhere else but I don't want to have having the "- [x] " or "- [ ] " in front of everything
Now, since I don't really know anything about AHK, and just fiddle with it from time to time I had no clue where to start
I stumbled upon RegExReplace on some forums, and I'm fairly certain it could work I just don't know how it works
So I copied a bit of code from a post that looked like this.

Code: Select all

F7::
Clipboard := RegExReplace(Clipboard, "- [x]  ","")
return
Now I don't think this would work because the "[" and "]" need to be escaped from what I understood.
And I would probably need to put it in a loop for it to do every line (wild guess here)
Maybe there's a way to remove everything from the start of a line and stop a "b" since they will always start with b?
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Removing certain characters from a list

21 Jun 2021, 12:54

Now I don't think this would work because the "[" and "]" need to be escaped from what I understood.
yes, they need to be
And I would probably need to put it in a loop for it to do every line (wild guess here)
no, use the multiline regex option flag

Code: Select all

RegExReplace(ClipBoard, "`am)^- \[[x ]\] ")
`aNYCRLF, if the selection contains line endings other than LF
hihixd
Posts: 6
Joined: 08 Aug 2020, 22:13

Re: Removing certain characters from a list

21 Jun 2021, 15:44

It works very well. Thank you :)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], TAC109 and 266 guests