Question about RegEx-basics?

Ask gaming related questions (AHK v1.1 and older)
larabee
Posts: 8
Joined: 06 Aug 2018, 16:06

Question about RegEx-basics?

12 Aug 2018, 18:19

I have problems with RegExMatch. The helps seem to be written for specialists, but you can't get help with the basics, like my question.

How do I find say the string "abc"?

For some reason the code

Code: Select all

FoundPos := RegExMatch (Line, "i)you cast your spell*")
is NOT found when I think it ought to be.

More generally formulating the question, can one use the (familiar) wildcards ('*', '?') when using RegEx with some examples, please? I don't need anything else for now.

One would think that the basics would be explained somewhere. Like start by explaining what 2+2 is, not by explaining how to calculate discrete logarithms.

Oh well :). Besides, my questions may very well have been answered somewhere???

Thanks!
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Question about RegEx-basics?

12 Aug 2018, 18:25

- Try this:

Code: Select all

;before:
FoundPos := RegExMatch (Line, "i)you cast your spell*")
;after (remove the space):
FoundPos := RegExMatch(Line, "i)you cast your spell*")
- I wrote this, I may think of further improvements to the 'quick tutorial' in the future.
jeeswg's RegEx tutorial (RegExMatch, RegExReplace) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=28031
- From that page:
;NOTES: REGEX EQUIVALENTS FOR ? AMD * WILDCARDS IN WINDOWS

;In Windows:
;? usually means 1 character [RegEx equivalent: .]
;* usually means 0 or more characters [RegEx equivalent: .*]
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
larabee
Posts: 8
Joined: 06 Aug 2018, 16:06

Re: Question about RegEx-basics?

12 Aug 2018, 19:48

Thank you very much!!!

You saved me thousends of headaches. If you think i'm exaggarating then how about hundreds? Or dozens?

Your tutorial was exactly what I was looking for when I wrote "Besides, my questions may very well have been answered somewhere???".

Thanks!

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 61 guests