Not only Autohotkey has access to ClipBoard but also all other Windows processes.
If you share a paper notebook with 10 neighbors, you can't read and write in it at any time.
Instead of:
Code: Select all
ClipBoard := RegExReplace(ClipBoard, ...) ;read and write in ClipBoard
Send, ^v ;paste
better:
Code: Select all
Clip := ClipBoard
Sleep, 100
Clip := RegExReplace(Clip, ...) ;read and write in Clip
ClipBoard := Clip
Sleep, 100
Send, ^v ;paste
Perhaps:
Code: Select all
in = https://twitter.com/𝗧𝗵𝗶𝘀𝗜𝘀𝗔𝗩𝗮𝗿𝗶𝗮𝗯𝗹𝗲/status/1452309437188870151
should = https://threadreaderapp.com/thread/1452309437188870151.html
RegExMatch(in, "https://twitter.com/[^/]+/status/\K\d+", output)
output := "https://threadreaderapp.com/thread/" output ".html"
MsgBox,% should "`n" output