RegExMatch error Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
afe
Posts: 615
Joined: 06 Dec 2018, 04:36

RegExMatch error

09 Dec 2018, 08:01

Hello everyone,
I want to match all ASCII printable characters. But this script can't pass. Where is the mistake?

I have already escaped \.*?+[]{}|()^$. Also I have tried using \Q...\E, but the problem remains. I'm confused.

Thanks.

Code: Select all


Haystack := "a"

RegExMatch(Haystack, "i)[0-9A-Z\s!"#\$%&'\(\)\*\+,-\./:;<=>\?@\[\\\]\^_`\{\|\}~]+", OutputVar)

msgbox % OutputVar

return
Last edited by afe on 09 Dec 2018, 13:17, edited 2 times in total.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: RegExMatch error  Topic is solved

09 Dec 2018, 09:34

  1. what are the contents of a?
  2. ahk syntax, escape the ": "i)[0-9A-Z\s!"#\$%&'\(\)\*\+,-\./:;<=>\?@\[\\\]\^_`\{\|\}~]+" ->>> "i)[0-9A-Z\s!""#\$%&'\(\)\*\+,-\./:;<=>\?@\[\\\]\^_`\{\|\}~]+"
afe
Posts: 615
Joined: 06 Dec 2018, 04:36

Re: RegExMatch error

09 Dec 2018, 10:03

It should be "a". I forgot "", I have corrected it.

Thank you very much. Now working fine.


I now know that double quotes need to be escaped. The official manual does not seem to mention that double quotes need to be escaped, and I always thought that the escape character must be \.

Thanks again.
afe
Posts: 615
Joined: 06 Dec 2018, 04:36

Re: RegExMatch error

09 Dec 2018, 11:20

Thank you very much.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 420 guests