What is the correct way to do the following?
Zone = ^#.*z39
If RegExMatch(A_LoopReadLine, "%Zone%")
The above does not work but the below does
If RegExMatch(A_LoopReadLine, "^#.*z39")
Thank you
using variable in RegExMatch
Re: using variable in RegExMatch
After further searching I think I have figured it out as it seems to work.
2 ways to go about it:
or
2 ways to go about it:
Code: Select all
Zone = ^#.*z39
If RegExMatch(A_LoopReadLine, "" . Zone . "")
Code: Select all
Zone = 39
If RegExMatch(A_LoopReadLine, "^#.*z" . Zone)
Re: using variable in RegExMatch
Hello.
Please see variables and expressions. You might find the tutorial useful.
Cheers.
Code: Select all
Zone := "^#.*z39"
If RegExMatch(A_LoopReadLine, Zone)
Cheers.
Re: using variable in RegExMatch
So Ive been using:
which is working fine, but now I need to add a \s for a space after Zone
I am having a difficult time figuring out how to do this.
Ive tried the obvious which does not work:
Any help is appreciated. Thank you
Code: Select all
Zone = 39
If RegExMatch(A_LoopReadLine, "^#.*z" . Zone)
I am having a difficult time figuring out how to do this.
Ive tried the obvious which does not work:
Code: Select all
Zone = 39
If RegExMatch(A_LoopReadLine, "^#.*z" . Zone\s)
Re: using variable in RegExMatch
What really should be obvious is to but the literal string part in quotes as was done with the other part.
Code: Select all
Zone = 39
If RegExMatch(A_LoopReadLine, "^#.*z" . Zone . "\s")
- Delta Pythagorean
- Posts: 627
- Joined: 13 Feb 2017, 13:44
- Location: Somewhere in the US
- Contact:
Re: using variable in RegExMatch
If you're having trouble with using Functions, do remember that all Functions use Expression mode for their parameters.
For example:
For example:
Code: Select all
Text = Hello world! ; Message of "Hello World!"
Title = Message Box ; Title of "Message Box"
Options = 0 ; Just the OK button
Timeout = 0 ; Timeout is infinite
MsgBox(Text, Title, Options, Timeout)
MsgBox(Text := "", Title := "", Options := "", Timeout := "") {
MsgBox, % Options, % Title, % Text, % Timeout
}
[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat
Who is online
Users browsing this forum: Google [Bot], Rohwedder and 53 guests