Code: Select all
clipboard:="my.website.ahk/page/1"
;Loop 5
clipboard:=RegExReplace(clipboard,"(\d+)/?$",RegExMatch(clipboard,"\d+",match)?match+1:"error")
MsgBox % clipboard
return
Code: Select all
clipboard:="my.website.ahk/page/1"
;Loop 5
clipboard:=RegExReplace(clipboard,"(\d+)/?$",RegExMatch(clipboard,"\d+",match)?match+1:"error")
MsgBox % clipboard
return
Code: Select all
num := 0
string := "beginning.of.string\"
Loop, 5
MsgBox % string . (num := num + 1)
Code: Select all
String := "my.website.ahk/page/1"
Loop, 5
MsgBox, % Inc(String)
ExitApp
;-------------------------------------------------------------------------------
Inc(ByRef String) {
;-------------------------------------------------------------------------------
RegExMatch(String, "(?<Head>.*)(?<Num>\d+)/?$", $)
Return, String := $Head . ++$Num
}
Code: Select all
num := 1
clipboard := "my.website.ahk/page/1"
#s::
clipboard := RegExReplace(clipboard, "(\d+)(?C:NumAddOne)", num)
ToolTip, % clipboard
return
NumAddOne(Match){
Global num
if(Match is number) {
num := Match + 1
return 0
}
return 1
}
Code: Select all
NumpadSub::
Send ^l^c
clipboard:=RegExReplace(clipboard,"(\d+)/?$",RegExMatch(clipboard,"\d+",match)?match+1:"error")
Send ^l^v{Enter}
return
Code: Select all
NumpadSub::
Send ^l^c
If RegExMatch(clipboard,"\d+/?$",match) ; I did change the end-of-line anchor and optional / which wasn't in my original code
clipboard:=RegExReplace(clipboard,"\d+/?$",match+1)
Send ^l^v{Enter}
return
Code: Select all
^2::
Loop 5
{
clipboard := "my.website.ahk/page/" A_Index
clipboard := RegExReplace(clipboard, "(\d+)(?C:NumAddOne)", num)
ToolTip, % clipboard
Sleep 1000
}
return
NumAddOne(Match){
Global num
if Match is number ; can't have the OTB style, nor do you want this as an expression with the parentheses that you had before
{
num := Match + 1
return 0
}
return 1
}