RegExReplace() runs differently on Clipboard then in Var - solutions?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Saiftey
Posts: 18
Joined: 08 May 2018, 18:30

RegExReplace() runs differently on Clipboard then in Var - solutions?

18 Jun 2018, 10:21

My problem: running RegExReplace on my input using var= causes RegExReplace to see the data differently to when I run it on clipboard data.. Why? It is the exact same RegExReplace - Why is it working differently depending on if I use the RegExRepalce on clipboard or var.. I need a solution to get the desired output..

Script:

Code: Select all

^q::pause, toggle
^e::Reload

^F1::
var=
(
====By [[TM]]/[[HM]]====
{{learnlist/tmh|Bulbasaur|grass|poison|1|1}}
{{learnlist/tm1|TM03|Swords Dance|Normal|—|—|30}}
{{learnlist/tm1|TM06|Toxic|Poison|—|85|10}}
{{learnlist/tm1|TM50|Substitute|Normal|—|—|10}}
{{learnlist/tm1|HM01|Cut|Normal|50|95|30}}
{{learnlist/tmf|Bulbasaur|grass|poison|1|1}}

[[zh:妙蛙种子/第一世代招式表]]

)

str := var
str := RegExReplace(str, "mi)(===.*\r\n|{{learnlist\/(tm|level)[hH].*\r\n|{{learnlist\/(tm|level)[fF](?s).*)" , "")`
msgbox %str%

return

esc::
exitapp
result it SHOULD produce but doesn't (and it produces this when running RegExReplace on clipboard instead):

Code: Select all

{{learnlist/tm1|TM50|Substitute|Normal|—|—|10}}
{{learnlist/tm1|TM03|Swords Dance|Normal|—|—|30}}
{{learnlist/tm1|TM06|Toxic|Poison|—|85|10}}
Result it does produce when running RegExReplace on Var=

Code: Select all

====By [[TM]]/[[HM]]====
{{learnlist/tmh|Bulbasaur|grass|poison|1|1}}
{{learnlist/tm1|TM03|Swords Dance|Normal|—|—|30}}
{{learnlist/tm1|TM06|Toxic|Poison|—|85|10}}
{{learnlist/tm1|TM50|Substitute|Normal|—|—|10}}
RegExReplace is recognizing information in Var= and Clipboard differently even though it is exactly the same - I am not sure why.

This problem even occurs on GUI edit box

Note - Here is regex101 working incase this helps - https://regex101.com/r/gCMz1V/1/
The problem lies something to do with \r\n or \n , something about the lines i dont know what
Last edited by Saiftey on 18 Jun 2018, 10:34, edited 1 time in total.
Saiftey
Posts: 18
Joined: 08 May 2018, 18:30

Re: RegExReplace() runs differently on Clipboard then in Var - solutions?

18 Jun 2018, 10:29

The answer I think lies with the editbox using \r\n or \n - something to do with this

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 358 guests