Page 1 of 1

Trying to understand regex syntax in PMC

Posted: 19 Aug 2022, 23:39
by jackblack2009
Hi Yall, :shock:

I have a string my macro copies to the clipboard.

Wickliffe Court 25 Wickliffe Avenue LONDON N3 3EL

Im trying to extract and store the house/street, town and Postcode in different variables.

To this end, Here I'm first trying to extract the street.

Using

https://regexr.com/

The following code seems to work.

Code: Select all

.*(?=\s[A-Z]{3,})
Spoiler
But I get an empty messge box when I run this through PMC.

Code: Select all

MsgBox, 0, , %clipboard%                                                       ---  I can see PMC has read the clipboard Ok
ex1 := RegExMatch(clipboard , ".*(?=\s[A-Z]{3,})" , varo1)        --- I must need to reformat my query because...
MsgBox, 0, , %varo1%                                                             --- No result. Empty Box.
Other basic searches work. So I feel that as I can otherwise get PMC to read the clipboard, run a search and store that result in %varo1%....

there must be something im missing re my regex code when trying to use this basic lookahead algo in PMC.

Again, it seems to work on regexr and Ive had a good look at the documentation on autohotkey....

Anyone here see / understand where im going wrong?

Kind regards everyone. Much Love. :crazy: :salute:

Re: Trying to understand regex syntax in PMC

Posted: 20 Aug 2022, 08:26
by Pulover
Does it work when you export the script to ahk or exe?

Re: Trying to understand regex syntax in PMC

Posted: 20 Aug 2022, 23:02
by jackblack2009
Pulover wrote:
20 Aug 2022, 08:26
Does it work when you export the script to ahk or exe?
Ahh. Yes.

and cheers chief. loving PMC




..and creating an exe also worked.

So whats going on here then? :xmas: did i find a feature :HeHe:

Gonna have a look at the source for fun/practice but will have no idea whats going on. Ill be surprised if i can even find the code related to regex. ..and id wonder IF this behavior even had anything to do with that :roll:

thanks again dude

Re: Trying to understand regex syntax in PMC

Posted: 26 Aug 2022, 06:08
by Pulover
There might be a bug, then. Maybe in the Eval function. You might as well open an issue on github.