RegEx, AHK, MS Word

Discuss other programming languages besides AutoHotkey
pom

RegEx, AHK, MS Word

24 Feb 2015, 07:42

This is Haystack:
higher temperature
random text
higher random text random text temperature
This is NeedleRegEx: hig.{1,6}tem, which finds the following (red) pattern:
higher temperature
random text
higher random text random text temperature
However, when I go to MS Word's Advanced Find, check "use wildcards" checkbox and type hig?{1,6}tem , which is compatible with hig.{1,6}tem NeedleRegEx, it finds the following (red) patterns:
higher temperature
random text
higher random text random text temperature
Why does it find higher random text random text tem pattern? If I understand this correctly, it shouldn't find it because there are much more than 6 characters between hig and tem. But it finds it… Why? I don't understand am I doing something wrong or is it a bug in MS Word?
Thanks.


Moderator: moved from Ask for Help since this is not an AHK question.
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: RegEx, AHK, MS Word

27 Feb 2015, 03:24

While wild card search is similar to RegEx, its definitely not the same.
Looks like the `Any single character` or ? token is being repeated in this case ( not sure why )..
Also wildcards deal with spaces much differently than RegEx.

After some messing around I've come to realize you can't use space as a `special character`..
try: hig[a-z]{1,6} tem

htms
pom

Re: RegEx, AHK, MS Word

27 Feb 2015, 06:57

TLM wrote:Looks like the `Any single character` or ? token is being repeated in this case ( not sure why )..
Yes... :?
TLM wrote:try: hig[a-z]{1,6} tem
That worked well in this situation. Thank you! :)

Return to “Other Programming Languages”

Who is online

Users browsing this forum: No registered users and 45 guests