So, what is the needle for this:
Code: Select all
LargeString:="12345""Any string enclosed in quotes""abcde"
Prefix:="12345"
Suffix:="abcde"
Needle:=Prefix . "what is the Needle" . Suffix
IntPos:=RegExMatch(LargeString,Needle,Match)
MsgBox, % Match
MsgBox, % Match1
For the integer,
[\d,]+ works a charm as the needle. What is the needle for an arbitrary string (enclosed in quotes) between the prefix and suffix?
To make it clearer, here's some non-RegEx code:
Code: Select all
LargeString:="12345""Any string enclosed in quotes""abcde"
Prefix:="12345"
Suffix:="abcde"
BeginPos:=InStr(LargeString,Prefix)+StrLen(Prefix)+1
EndPos:=InStr(LargeString,"""",,BeginPos)
ExtractedString:=SubStr(LargeString,BeginPos,EndPos-BeginPos)
MsgBox % ExtractedString
Of course, that's not really a solution, because it will find the Prefix even if it is not followed by the Suffix (in fact, the Suffix isn't even used in the code). But it should give you the idea of what I'm looking for. Thanks, Joe