Page 1 of 1

escape characters issue

Posted: 20 Oct 2018, 19:30
by jeeswg
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

Re: escape characters issue

Posted: 21 Oct 2018, 01:40
by nnnik
this really does appear to be a bug.

Re: escape characters issue  Topic is solved

Posted: 11 Nov 2018, 02:15
by lexikos
v1.1.30.01 fixes this.