regexmatch help Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
awcrt9316
Posts: 61
Joined: 03 Mar 2020, 20:06

regexmatch help

04 Apr 2020, 16:24

I am trying to figure out how to recognize if there is a number at the end of a word :headwall: I've used regex before but never quite understood it fully (i am new to ahk)


Code: Select all


if regexmatch(apple + [1-9]) ; if detect a specific word plus a number 1-9

var:= apple ; make var equal to the word without the number



User avatar
boiler
Posts: 4668
Joined: 21 Dec 2014, 02:44

Re: regexmatch help  Topic is solved

04 Apr 2020, 16:47

Code: Select all

text := "apple8"
RegExMatch(text, "\D+", var)
MsgBox, % var
User avatar
Chunjee
Posts: 446
Joined: 18 Apr 2014, 19:05
GitHub: Chunjee

Re: regexmatch help

04 Apr 2020, 16:56

I think this is similar:

Code: Select all

string := "apple9"
RegExMatch(string, "O)(\D+)\d", UnquotedOutputVar)
msgbox, % UnquotedOutputVar[1]
; => "apple
You can read more about RegExMatch at https://www.autohotkey.com/docs/commands/RegExMatch.htm
awcrt9316
Posts: 61
Joined: 03 Mar 2020, 20:06

Re: regexmatch help

04 Apr 2020, 17:20

thx for your help!

Return to “Ask For Help”

Who is online

Users browsing this forum: barbudo2005, Chunjee, vlakmire, yuyu and 162 guests