AutoHotkey

My current script successfully deletes the first character in a string, unless that character is a newline (`n). Even trying to put m in front of (?) to attempt to make it multiline changes nothing:

Contents := RegExReplace(Contents, '(?)^.{0,1}')

Suppose the variable Contents is:

123
456

It'll delete 1, then 2, then 3 (if you call it 3 times), but then it will never make it past the line break and get stuck and won't reach 456. Any help would be appreciated! I'm a Regex newb, but I'm not glued to Regex by any means and would be happy to use any other function to be able to do this. I'm just hopefully trying to do it all in one line, though I will use two lines if it comes down to it.

If you're just trying to strip the first character regardless of what it is then SubStr(Contents, 2) would be a much better. I know you said you weren't married to regex, but if you wanted to do the same with regex you would do 's)^.', per the documentation the "s" option makes the "." character include newlines and it's related characters. By default for some reason Autohotkey's regexes exclude newlines from the ".".

1 replies

Can AHK apply a dynamic filename to a file it makes?

1y 2mon ago by programming.dev/u/Flagstaff in ahk@programming.dev
682

Is it possible to replicate two graphics like this per keystroke offline on the screen at all times?

1y 2mon ago by programming.dev/u/Flagstaff in ahk@programming.dev from www.youtube.com
423

Is there a way to make AHK perform actions when you click on the tray tip that TrayTip() pops out?

1y 3mon ago by programming.dev/u/Flagstaff in ahk@programming.dev
544

so i have this extra monitor that i wanted to turn into a fake window some times

1y 8mon ago by lemm.ee/u/Lemjukes in ahk@programming.dev from github.com
715

Does anyone use AHK with Adobe Acrobat Pro?

2y 11mon ago by lemmy.world/u/Kethal in ahk@programming.dev
216

Script Showcase | AutoHotkey v2

3y 20d ago by programming.dev/u/biothoth in ahk@programming.dev from www.autohotkey.com
707