Haystack := "01*02*03*04*05*TEXT1*TEXT2*TEXT3" Haystack := RegExReplace(Haystack,"^.*?\*(?=\D)") ; remove everything up to the first star followed by a non-digit Loop, parse, Haystack, * ; parse 'Haystack' if A_Index > 2 ; only parse the first two stars since the third term might have a star break else var%A_Index% := A_LoopField var3 := SubStr(Haystack,StrLen(var1)+StrLen(var2)+3) MsgBox % var1 "`n" var2 "`n" var3
Put here requests of problems with regular expressions
Recommended: AutoHotkey Boards
Tutorial for Newbies
Quick Search for Autohotkey|Beginner's RegEx Tutorial|Command Object Functions
COM Object Reference|COM - Basic Webpage Controls|Acc Library
also, \h that represents any whitespace character (space, tab, but not newline, or other) does not seem to work, which is the alternative?
For the any character; use the DOTALL option where you can. Everywhere else I end up using (.|\n).
Request Video Tutorials Here or View Current Tutorials on YouTube
Any code ⇈ above ⇈ requires AutoHotkey_L to run
it complicates alot the code (because, first, s is meant for space, second, I dont know where it is enabled and where it is not, third, I need to disable it if I dont want to use it, etc), so, I came up with this, that seems to do the job:
As there are only three RE related pages in the documentation you must be joking. DotAll is described perfectly, no need for further documentation.
I did not find sufficient documentation for DotAll, but it seems I just need to place (?s) before the dot to enable it
RegExReplace("%xx%" , "[color=red]sm)[/color].*^COMPANY NAME\h+: (.+)$[color=red]sm)[/color].*" , "$1")
RegExReplace("[color=red]%[/color]xx[color=red]%[/color]" , "sm).*^COMPANY NAME\h+: (.+)$sm).*" , "$1")
also, lose the "quotes" around the xx.
rawr. be very afraid
. Populate the AutoHotkey city. Pointless but somewhat fun. .
RunWait, pdftotext -f 1 -l 1 -layout 1.pdf x-timestamp.txt FileRead, xx, x-timestamp.txt msgbox %xx% ClientID := RegExReplace(xx, "m).*^COMPANY NAME\s+: (.+)$.*", "$1") msgbox %ClientID% FileMove, 1.pdf, %ClientID%.pdf
both xx and ClientID are the whole text of the x-timestamp.txt, while it should be only the (.+) of the "sm).*^COMPANY NAME\s+: (.+)$.*"