escape characters issue Topic is solved

Report problems with documented functionality
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

escape characters issue

20 Oct 2018, 19:30

Generally it appears that text is read from left to right, and so:
``t is interpreted as `` then t and so appears literally as `t
``, is interpreted as `` then , and so appears literally as `,
However semicolon appears to be an exception:
``; appears literally as ;

I did not see any mention of this in the documentation. In case anyone can clarify the situation.

Code: Select all

;#EscapeChar - Syntax & Usage | AutoHotkey
;https://autohotkey.com/docs/commands/_EscapeChar.htm

q::
;list: _ `_ `_ ``_
MsgBox, % "`_"
MsgBox, % "``_"
MsgBox, % "```_"
MsgBox, % "````_"

;list: , `, `, ``,
MsgBox, % "`,"
MsgBox, % "``,"
MsgBox, % "```,"
MsgBox, % "````,"

;list: , `, `, ``,
MsgBox `,
MsgBox ``,
MsgBox ```,
MsgBox ````,

;list: ; ; `; `; [different from other characters]
MsgBox, % "`;"
MsgBox, % "``;"
MsgBox, % "```;"
MsgBox, % "````;"

;list: ; ; `; `; [different from other characters]
MsgBox `;
MsgBox ``;
MsgBox ```;
MsgBox ````;

;list: (whitespace) `t ` ``t
MsgBox, % "`t"
MsgBox, % "``t"
MsgBox, % "```t"
MsgBox, % "````t"
return
Here's an example of where having a good understanding of escape characters is important:

Code: Select all

q:: ;replacing `%, useful when parsing/converting AHK v1 command-style parameters e.g. `% %var% `%
;e.g. replace literal percent signs with an unused character temporarily
vUnused := "_"
vText := "`% ``% ```% ````%"
MsgBox, % vText "`r`n" RegExReplace(vText, "(^|[^``])(````)*\K```%", vUnused)
vText := "``% ````% ``````% ````````%"
MsgBox, % vText "`r`n" RegExReplace(vText, "(^|[^``])(````)*\K```%", vUnused)
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: escape characters issue

21 Oct 2018, 01:40

this really does appear to be a bug.
Recommends AHK Studio
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: escape characters issue  Topic is solved

11 Nov 2018, 02:15

v1.1.30.01 fixes this.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 20 guests