Code: Select all
&length_seconds=1081&of=
I tried the following
Code: Select all
FoundPos := RegExMatch(VideoLengthRaw, "(?<=&length_seconds=).*?(?&of=)", VideoLength)
Code: Select all
"(?<=length_seconds=).*?(?=&relative_loudness)"
Code: Select all
&length_seconds=1081&of=
Code: Select all
FoundPos := RegExMatch(VideoLengthRaw, "(?<=&length_seconds=).*?(?&of=)", VideoLength)
Code: Select all
"(?<=length_seconds=).*?(?=&relative_loudness)"
Code: Select all
str:="&length_seconds=1081&of="
regexmatch(str,"O)&length_seconds=(\d+)&of=",m)
msgbox % m.pos(1) "`t" m[1]
egocarib, for some reason this solution doesn't work. Meaning, if I replace my original non-workingegocarib wrote:You are missing an equals sign in your regex string.
Old: (?<=&length_seconds=).*?(?&of=)
New: (?<=&length_seconds=).*?(?=&of=)
Note that \d matches only numbers. So it might be easier to use that in your regex match string, depending on what the rest of the pattern looks like. For example, the simple regex pattern \d+ matches the number in the example string you provided.
Code: Select all
FoundPos := RegExMatch(VideoLengthRaw, "(?<=&length_seconds=).*?(?&of=)", VideoLength)
Code: Select all
FoundPos := RegExMatch(VideoLengthRaw, "(?<=&length_seconds=).*?(?=&of=)", VideoLength)
Code: Select all
MsgBox % VideoLength
Helgef, is there a way to integrate your suggestion into my originalHelgef wrote:Hello. Please try this,Code: Select all
str:="&length_seconds=1081&of=" regexmatch(str,"O)&length_seconds=(\d+)&of=",m) msgbox % m.pos(1) "`t" m[1]
Code: Select all
FoundPos := RegExMatch(VideoLengthRaw, "(?<=&length_seconds=).*?(?&of=)", VideoLength)
Code: Select all
"O)&length_seconds=(\d+)&of="
Code: Select all
regexmatch(str,"&length_seconds=(?P<ideoLength>\d+)&of=", V) ; :(
msgbox % VideoLength
Helgef, thanks so much again for your input, I really do appreciate this a ton! I'm new to this and it really does help.Helgef wrote:Other than the obvious, I have no good suggestion,Code: Select all
regexmatch(str,"&length_seconds=(?P<ideoLength>\d+)&of=", V) ; :( msgbox % VideoLength
The obvious
VideoLengthRaw is this file ( https://www.dropbox.com/s/li5f8fursrovw ... _info?dl=0 ) saved into that variable via URLDownloadToFile function (whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")). I tried debugging via both the methods you suggested, and the contents of VideoLengthRaw looks exactly like whole file - check out that dropbox link which has that whole text file.egocarib wrote:You need to debug a bit. What does str look like after you do str := VideoLengthRaw?
Try MsgBox % VideoLengthRaw, or if it's a large file, try Clipboard := VideoLengthRaw and then paste the output into notepad to see what the variable contents look like.
Users browsing this forum: scriptor2016 and 291 guests