Mun Posted June 22, 2013 Posted June 22, 2013 (edited) https://docs.google.com/file/d/0B29c17sMi0jQV1l3bURzaWdWZXM/edit?usp=drive_web https://docs.google.com/file/d/0B29c17sMi0jQRzNueEVxdElxZDA/edit https://docs.google.com/file/d/0B5ga7v4zTx-jNTBiUFZuc2ZxSUE/edit https://docs.google.com/file/d/0BzCopv2TGnqOQlVhTDFIM1BfaG8/edit?usp=sharing Would anyone help with a regex to extract red part into an array parsing from this mess? <span style='border:none windowtext 1.0pt;padding:0in;text-decoration:none'><img border=0 id="_x0000_i1066" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> </span><span style='color:#1155CC;border:none windowtext 1.0pt;padding:0in;text-decoration:none'>Work Order 1987539 041.jpg</span></a><o:p></o:p></span></b></p></div><p class=MsoNormal><o:p> </o:p></p><div style='border:solid #DDDDDD 1.0pt;padding:4.0pt 4.0pt 4.0pt 4.0pt;max-height:18px'><p class=MsoNormal style='background:whitesmoke'><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222'><a href="https://docs.google.com/file/d/0B5ga7v4zTx-jYXpwNE5oYnF5bms/edit?usp=drive_web" target="_blank"><span style='border:none windowtext 1.0pt;padding:0in;text-decoration:none'><img border=0 id="_x0000_i1067" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> </span><span style='color:#1155CC;border:none windowtext 1.0pt;padding:0in;text-decoration:none'>Work Order 1987539 042.jpg</span></a><o:p></o:p></span></b></p></div><p class=MsoNormal><o:p> </o:p></p><div style='border:solid #DDDDDD 1.0pt;padding:4.0pt 4.0pt 4.0pt 4.0pt;max-height:18px'><p class=MsoNormal style='background:whitesmoke'><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222'><a href="https://docs.google.com/file/d/0B5ga7v4zTx-jSVZiMWRJdlpVbnc/edit?usp=drive_web" target="_blank"><span style='border:none windowtext 1.0pt;padding:0in;text-decoration:none'><img border=0 id="_x0000_i1068" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> </span><span style='color:#1155CC;border:none windowtext 1.0pt;padding:0in;text-decoration:none'>Work Order 1987539 043.jpg</span></a><o:p></o:p></span></b></p></div><p class=MsoNormal><o:p> </o:p></p><div style='border:solid #DDDDDD 1.0pt;padding:4.0pt 4.0pt 4.0pt 4.0pt;max-height:18px'><p class=MsoNormal style='background:whitesmoke'><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222'><a href="https://docs.google.com/file/d/0B5ga7v4zTx-jUDRuQ3R4Rmw1VEE/edit?usp=drive_web" target="_blank"><span style='border:none windowtext 1.0pt;padding:0in;text-decoration:none'><img border=0 id="_x0000_i1069" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> </span><span style='color:#1155CC;border:none windowtext 1.0pt;padding:0in;text-decoration:none'>Work Order 1987539 044.jpg</span></a><o:p></o:p></span></b></p></div><p class=MsoNormal><o:p> </o:p></p><div style='border:solid #DDDDDD 1.0pt;padding:4.0pt 4.0pt 4.0pt 4.0pt;max-height:18px'><p class=MsoNormal style='background:whitesmoke'><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222'><a href="https://docs.google.com/file/d/0B5ga7v4zTx-jd1dfNkpZcUM1aHc/edit?usp=drive_web" target="_blank"><span style='border:none windowtext 1.0pt;padding:0in;text-decoration:none'><img border=0 id="_x0000_i1070" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> </span><span style='color:#1155CC;border:none windowtext 1.0pt;padding:0in;text-decoration:none'>Work Order 1987539 044.zip</span></a><o:p></o:p></span></b></p></div><p class=MsoNormal><o:p> </o:p></p><div style='border:solid #DDDDDD 1.0pt;padding:4.0pt 4.0pt 4.0pt 4.0pt;max-height:18px'><p class=MsoNormal style='background:whitesmoke'><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222'><a href="https://docs.google.com/file/d/0B5ga7v4zTx-jS0RVbDJBS2JxSkU/edit?usp=drive_web" target="_blank"><span style='border:none windowtext 1.0pt;padding:0in;text-decoration:none'><img border=0 id="_x0000_i1071" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> </span><span style='color:#1155CC;border:none windowtext 1.0pt;padding:0in;text-decoration:none'>Work Order 1987539 045.jpg</span></a><o:p></o:p></span></b></p></div><p class=MsoNormal><o:p> </o:p></p><div style='border:solid #DDDDDD 1.0pt;padding:4.0pt 4.0pt 4.0pt 4.0pt;max-height:18px'><p class=MsoNormal style='background:whitesmoke'><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222'><a href="https://docs.google.com/file/d/0B5ga7v4zTx-jR3pVbXBjV2VuWlk/edit?usp=drive_web" target="_blank"><span style='border:none windowtext 1.0pt;padding:0in;text-decoration:none'><img border=0 id="_x0000_i1072" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> </span><span style='color:#1155CC;border:none windowtext 1.0pt;padding:0in;text-decoration:none'>Work Order 1987539 046.jpg</span></a><o:p></o:p></span></b></p></div><p class=MsoNormal><o:p> </o:p></p><div style='border:solid #DDDDDD 1.0pt;padding:4.0pt 4.0pt 4.0pt 4.0pt;max-height:18px'><p class=MsoNormal style='background:whitesmoke'><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222'><a href="https://docs.google.com/file/d/0B5ga7v4zTx-jTTdiLWhPbU1rOU0/edit?usp=drive_web" target="_blank"><span style='border:none windowtext 1.0pt;padding:0in;text-decoration:none'><img border=0 id="_x0000_i1073" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> </span><span style='color:#1155CC;border:none windowtext 1.0pt;padding:0in;text-decoration:none'>Work Order 1987539 047.jpg</span></a><o:p></o:p></span></b></p></div><p class=MsoNormal><o:p> </o:p></p><div style='border:solid #DDDDDD 1.0pt;padding:4.0pt 4.0pt 4.0pt 4.0pt;max-height:18px'><p class=MsoNormal style='background:whitesmoke'><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222'><a href="https://docs.google.com/file/d/0B5ga7v4zTx-jcHVMNHF1NHhhYWM/edit?usp=drive_web" target="_blank"> Edited June 22, 2013 by Mun
Mun Posted June 22, 2013 Author Posted June 22, 2013 (edited) ** I have got it on my own. If you have better method than what I have please demonstrate. expandcollapse popup#include <array.au3> #include <String.au3> #cs COPY THIS <span style='border:none windowtext 1.0pt;padding:0in;text-decoration:none'><img border=0 id="_x0000_i1066" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> </span><span style='color:#1155CC;border:none windowtext 1.0pt;padding:0in;text-decoration:none'>Work Order 1987539 041.jpg</span></a><o:p></o:p></span></b></p></div><p class=MsoNormal><o:p> </o:p></p><div style='border:solid #DDDDDD 1.0pt;padding:4.0pt 4.0pt 4.0pt 4.0pt;max-height:18px'><p class=MsoNormal style='background:whitesmoke'><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222'><a href="https://docs.google.com/file/d/0B5ga7v4zTx-jYXpwNE5oYnF5bms/edit?usp=drive_web" target="_blank"><span style='border:none windowtext 1.0pt;padding:0in;text-decoration:none'><img border=0 id="_x0000_i1067" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> </span><span style='color:#1155CC;border:none windowtext 1.0pt;padding:0in;text-decoration:none'>Work Order 1987539 042.jpg</span></a><o:p></o:p></span></b></p></div><p class=MsoNormal><o:p> </o:p></p><div style='border:solid #DDDDDD 1.0pt;padding:4.0pt 4.0pt 4.0pt 4.0pt;max-height:18px'><p class=MsoNormal style='background:whitesmoke'><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222'><a href="https://docs.google.com/file/d/0B5ga7v4zTx-jSVZiMWRJdlpVbnc/edit?usp=drive_web" target="_blank"><span style='border:none windowtext 1.0pt;padding:0in;text-decoration:none'><img border=0 id="_x0000_i1068" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> </span><span style='color:#1155CC;border:none windowtext 1.0pt;padding:0in;text-decoration:none'>Work Order 1987539 043.jpg</span></a><o:p></o:p></span></b></p></div> <p class=MsoNormal><o:p> </o:p></p><div style='border:solid #DDDDDD 1.0pt;padding:4.0pt 4.0pt 4.0pt 4.0pt;max-height:18px'><p class=MsoNormal style='background:whitesmoke'><b> <span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222'><a href="https://docs.google.com/file/d/0B5ga7v4zTx-jUDRuQ3R4Rmw1VEE/edit?usp=drive_web" target="_blank"> <span style='border:none windowtext 1.0pt;padding:0in;text-decoration:none'><img border=0 id="_x0000_i1069" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> </span> <span style='color:#1155CC;border:none windowtext 1.0pt;padding:0in;text-decoration:none'>Work Order 1987539 044.jpg</span></a><o:p></o:p></span></b></p></div><p class=MsoNormal><o:p> </o:p></p> <div style='border:solid #DDDDDD 1.0pt;padding:4.0pt 4.0pt 4.0pt 4.0pt;max-height:18px'><p class=MsoNormal style='background:whitesmoke'><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222'><a href="https://docs.google.com/file/d/0B5ga7v4zTx-jd1dfNkpZcUM1aHc/edit?usp=drive_web" target="_blank"> <span style='border:none windowtext 1.0pt;padding:0in;text-decoration:none'><img border=0 id="_x0000_i1070" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> </span> <span style='color:#1155CC;border:none windowtext 1.0pt;padding:0in;text-decoration:none'>Work Order 1987539 044.zip</span></a><o:p></o:p></span></b></p></div><p class=MsoNormal><o:p> </o:p></p> <div style='border:solid #DDDDDD 1.0pt;padding:4.0pt 4.0pt 4.0pt 4.0pt;max-height:18px'><p class=MsoNormal style='background:whitesmoke'><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222'><a href="https://docs.google.com/file/d/0B5ga7v4zTx-jS0RVbDJBS2JxSkU/edit?usp=drive_web" target="_blank"><span style='border:none windowtext 1.0pt;padding:0in;text-decoration:none'><img border=0 id="_x0000_i1071" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> </span><span style='color:#1155CC;border:none windowtext 1.0pt;padding:0in;text-decoration:none'>Work Order 1987539 045.jpg</span></a><o:p></o:p></span></b></p></div><p class=MsoNormal><o:p> </o:p></p><div style='border:solid #DDDDDD 1.0pt;padding:4.0pt 4.0pt 4.0pt 4.0pt;max-height:18px'><p class=MsoNormal style='background:whitesmoke'><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222'><a href="https://docs.google.com/file/d/0B5ga7v4zTx-jR3pVbXBjV2VuWlk/edit?usp=drive_web" target="_blank"><span style='border:none windowtext 1.0pt;padding:0in;text-decoration:none'> <img border=0 id="_x0000_i1072" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> </span><span style='color:#1155CC;border:none windowtext 1.0pt;padding:0in;text-decoration:none'>Work Order 1987539 046.jpg</span></a><o:p></o:p></span></b></p></div><p class=MsoNormal><o:p> </o:p></p><div style='border:solid #DDDDDD 1.0pt;padding:4.0pt 4.0pt 4.0pt 4.0pt;max-height:18px'><p class=MsoNormal style='background:whitesmoke'><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222'><a href="https://docs.google.com/file/d/0B5ga7v4zTx-jTTdiLWhPbU1rOU0/edit?usp=drive_web" target="_blank"><span style='border:none windowtext 1.0pt;padding:0in;text-decoration:none'><img border=0 id="_x0000_i1073" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> </span><span style='color:#1155CC;border:none windowtext 1.0pt;padding:0in;text-decoration:none'>Work Order 1987539 047.jpg</span></a><o:p></o:p></span></b></p></div><p class=MsoNormal><o:p> </o:p></p><div style='border:solid #DDDDDD 1.0pt;padding:4.0pt 4.0pt 4.0pt 4.0pt;max-height:18px'><p class=MsoNormal style='background:whitesmoke'><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222'><a href="https://docs.google.com/file/d/0B5ga7v4zTx-jcHVMNHF1NHhhYWM/edit?usp=drive_web" target="_blank"> #ce Global $Html = ClipGet() ; need to hold through clipboard since string is cluster with " ' __GetURLs($Html) Func __GetURLs($s_str) Local $s_pattern = "(?i)href\s*=\s*\x22(.+?)\x22[^>]*>" Local $temp If @error Then Return SetError(1, 0, 0) $aLinks = StringRegExp($s_str, $s_pattern, 4) If IsArray($aLinks) Then Local $address[Ubound($aLinks)] For $i = 0 To Ubound($aLinks) - 1 Step 1 $array = $aLinks[$i] ; get the array for this entry $temp = _StringBetween($array[1], "/d/","/edit") $address[$i] = $temp[0] ConsoleWrite("" & $array[1] & @CRLF) Next _ArrayDisplay($address) EndIf EndFunc Edited June 22, 2013 by Mun
mikell Posted June 22, 2013 Posted June 22, 2013 You should keep only the 'working' part $Html = ClipGet() $array = _StringBetween($Html, "/d/","/edit") _ArrayDisplay($array)
Mun Posted June 22, 2013 Author Posted June 22, 2013 (edited) Maybe it's my way of thinking... I seem to always go for the longest route. Ugh! Thanks mikell for pointing out the more obvious. Edited June 22, 2013 by Mun
Solution guinness Posted June 22, 2013 Solution Posted June 22, 2013 #include <Array.au3> Example() Func Example() Local $aSRE = StringRegExp(ClipGet(), '/file/d/([\w\-]+)/edit', 3) ; Check if the array contains item. IsArray is useless really! If UBound($aSRE) Then _ArrayDisplay($aSRE) EndFunc ;==>Example UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
mikell Posted June 22, 2013 Posted June 22, 2013 Or like this Local $aSRE = StringRegExp(ClipGet(), '/file/d/([^/]+)', 3) though those that are new to AutoIt or have limited experience should use the UDFs that come with AutoIt
guinness Posted June 22, 2013 Posted June 22, 2013 though those that are new to AutoIt or have limited experience should use the UDFs that come with AutoIt I agree, but Mun seems to have an understanding of regular expressions and was just over-complicating the matter. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
Mun Posted June 22, 2013 Author Posted June 22, 2013 (edited) I'm not normally afraid of tackling Regex as you see, there are many routes to get to the ending result. It is the thinking that made the difference and you can only pick someone brain where they have had the vast knowledge and experience down the road (Like you guys). I do enjoy shortcut as I always stumble through the forest *figuratively speaking* LOL Aside, very clean way to grab the string out Guinness. Thank you for sharing your knowledge. Combination of Guinness and Mikell - I did to swap the / to hex char x2F just to be precise. Local $aSRE = StringRegExp($s_str, '\x2Ffile\x2Fd\x2F([^\x2F]+)', 3) ;'/file/d/([^/]+)' Mikell| '/file/d/([\w\-]+)/edit' Guinness ; Check if the array contains item. IsArray is useless really! If UBound($aSRE) Then _ArrayDisplay($aSRE) Edited June 22, 2013 by Mun
guinness Posted June 22, 2013 Posted June 22, 2013 I could see that, it's why I was happy to help. Honestly, where my confusion comes into play with SRE, is which is more efficient, mine or mikell's? UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
mikell Posted June 22, 2013 Posted June 22, 2013 (edited) OK, I'm sorry The __GetURLs() func you first used looked like something grabbed somewhere on the forum and I was not sure about your understanding of regex Edit Honestly, I think the 2 regex work the same way, it's just a matter of style Edited June 22, 2013 by mikell
guinness Posted June 22, 2013 Posted June 22, 2013 OK, I'm sorry The __GetURLs() func you first used looked like something grabbed somewhere on the forum and I was not sure about your understanding of regex Ah, I thought you meant _StringBetween. It's a great function (though has it's limitations of course) so of course I would recommend this first of all. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
Mun Posted June 22, 2013 Author Posted June 22, 2013 (edited) OK, I'm sorry The __GetURLs() func you first used looked like something grabbed somewhere on the forum and I was not sure about your understanding of regex Edit Honestly, I think the 2 regex work the same way, it's just a matter of style Hmm...I actually thought of that naming (__GetURLs()) but I guess it can overly generalized. I did try to search the forum before posting but no one ever parse google share docs link before. Interestingly off topic searching google for autoit google docs parsing yield this thread as first result. Wow they are super fast or efficient with parsing this forum since this thread was posted yesterday. As for SRE comparation, Guinness' SRE parse more precise since it had bit more info "/edit" but failed to grab when google's naming convension change to /?p rather than /edit that why I choose Mikell. Not your fault since I have no way of knowing google autogenerate share link neither. I do hope they never change /file/d/ to /file/e/ LOL oh gosh lol Edited June 22, 2013 by Mun
guinness Posted June 22, 2013 Posted June 22, 2013 OK, well that is easily rectifiable and I only used the data you gave me. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
mikell Posted June 22, 2013 Posted June 22, 2013 Ha, it's the regex charm -- make a SRE as precise as possible while keeping the ability to accept some unexpected changes in the text to be treated ... really tricky indeed
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now