milkygirl90 wrote: ↑
correct.
keyword1 comprises 1 to 3 words
keyword2 and 3 can be both blank or 1 or 2 pure numbers
So I guess you're saying the "normal" scenario where each keyword is a single word only would never end with two blank inputs. Is that correct?
milkygirl90 wrote: ↑
I'm having a tough time understanding what each of the symbols does in the aHK docs. It's like greek to me. For instance,
Code: Select all
Circumflex (^) matches immediately after all internal newlines -- as well as at the start of Haystack where it always matches (but it does not match after a newline at the very end of Haystack).
That is not the correct context for the
^ as used here. You are referring to the part where it is an anchor to the beginning of the haystack, or in the case you quoted, the beginning of a line when the
m option is used, which was not done here. This usage is described a bit below that in
Commonly Used Symbols and Syntax:
RegEx Quick Reference wrote:[^...] -- Matches any single character that is not in the class. For example,
[^/]* matches zero or more occurrences of any character that is not a forward-slash, such as
http://. Similarly,
[^0-9xyz] matches any single character that isn't a digit and isn't the letter x, y, or z.
milkygirl90 wrote: ↑
I know plus sign matches the preceding character, but there are many + signs here which baffles me, why the need?
It is a quantifier that says to match one or more of the preceding character. If you didn't have that, then
\d would only match one digit, not potentially several in a row like
\d+ does. Without the
+, when attempting to match
123, it would only match
1.
milkygirl90 wrote: ↑
In addition, the backslash treats the + as literal. I don't understand why it needs to be treated literally since there's no + sign in my input box - just words and numbers.
You must have forgotten that you have a line in your code that replaces all spaces with
+ signs (below). That's why the pattern has to match the
+ signs instead of space characters.
Code: Select all
Keywords := StrReplace(Keywords, A_Space, "+") ; replace spaces with '+'
I think trying to work through it yourself and asking these kinds of specific questions will help you learn these topics better than not having attempted it, and in the long run it will be time well spent.