Using matched subpattern in expression Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Sweetins
Posts: 110
Joined: 02 Jul 2017, 13:22

Using matched subpattern in expression

14 Oct 2023, 16:45

In what follows, I get 79. But when I comment out String instance B and use A (first) instead, I get 0

Code: Select all

;str:="a`t‪78.9" ;strig instance A
str:="a`t78.9"  ;strig instance B
RegExMatch(str, "^[^`t]*`t([^`t]*)",match)
MsgBox,% Round(match1)
I mean how could I get 79 with this;

Code: Select all

str:="a`t78.9"  ;strig instance B
RegExMatch(str, "^[^`t]*`t([^`t]*)",match)
MsgBox,% Round(match1)
But get 0 with that;

Code: Select all

str:="a`t‪78.9" ;strig instance A
RegExMatch(str, "^[^`t]*`t([^`t]*)",match)
MsgBox,% Round(match1)
I have been working at my script for hours till I was able to narrow it down to this. How are we suppose to keep up with this whole scripting thing if we are to get such bugs. God knows how long it will take you to pin it down
Last edited by Sweetins on 14 Oct 2023, 16:53, edited 1 time in total.
User avatar
V0RT3X
Posts: 249
Joined: 20 May 2023, 21:59
Contact:

Re: Using matched subpattern in expression

14 Oct 2023, 16:50

Possibly the Return you have on your last MsgBox?

Code: Select all

MsgBox,% Round(match1)return
Sweetins
Posts: 110
Joined: 02 Jul 2017, 13:22

Re: Using matched subpattern in expression

14 Oct 2023, 16:54

Thanks for the response.
Last edited by Sweetins on 14 Oct 2023, 16:57, edited 1 time in total.
Sweetins
Posts: 110
Joined: 02 Jul 2017, 13:22

Re: Using matched subpattern in expression

14 Oct 2023, 16:56

V0RT3X wrote:
14 Oct 2023, 16:50
Possibly the Return you have on your last MsBox
Nuh... that was a typo. It's corrected
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Using matched subpattern in expression

14 Oct 2023, 17:29

Code: Select all

RegExMatch(str, "^[^`t]*`t\??([^`t]*)",match)
Sweetins
Posts: 110
Joined: 02 Jul 2017, 13:22

Re: Using matched subpattern in expression

14 Oct 2023, 17:43

Xtra wrote:
14 Oct 2023, 17:29

Code: Select all

RegExMatch(str, "^[^`t]*`t\??([^`t]*)",match)
How so? There aren't any question mark in either string
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Using matched subpattern in expression  Topic is solved

14 Oct 2023, 18:03

I copy pasted your original post code and it showed a ?
;str:="a`t?78.9" ;strig instance A
That tells me now that you have a hidden char.

There is your problem.
LRE LEFT-TO-RIGHT EMBEDDING U+202A
Attachments
Capture.PNG
Capture.PNG (6.42 KiB) Viewed 653 times
Sweetins
Posts: 110
Joined: 02 Jul 2017, 13:22

Re: Using matched subpattern in expression

14 Oct 2023, 18:31

Xtra wrote:
14 Oct 2023, 18:03
LRE LEFT-TO-RIGHT EMBEDDING U+202A
What!! :shock: .... how do I see these hidden characters (am using notepad++)? I bet there are a bunch of them around in my script.
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Using matched subpattern in expression

14 Oct 2023, 18:44

Notepad++ > View > Show Symbol > Show All Characters
Sweetins
Posts: 110
Joined: 02 Jul 2017, 13:22

Re: Using matched subpattern in expression

15 Oct 2023, 00:57

I see... did try that earlier but it never showed. I ended up getting convinced something wired was going on and started tearing my script down into pieces till I got to this rudimentary example.

Tried it in Regexbuddy and it showed anyways. Guess I could be relying on that in the mean time

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, Hansielein, Lpanatt and 329 guests