Decipher Posted November 18, 2012 Share Posted November 18, 2012 (edited) The function below works but I can't seem to iterate from 0 to 9 without the regexp check returning false. I thought that it might be a bug. I've tried putting it inside a loop where the digit would be replaced with the string below withReplacement: " & $i & "So that during each iteration....but it fails?I didn't want to mention that Regular Expressions could be part of the problems equation in the topic's title. Thanks for your help Func _TrimAfterYear($sTest) Local $aMatch = StringRegExp($sTest, "d{4}", 1) If IsArray($aMatch) Then Local $iPos = StringInStr($sTest, $aMatch[0]) + 3 Local $sPart = StringMid($sTest, $iPos) If StringRegExp($sPart, "(?i)(pt 2)|(pt2)|(part2)|(part 2)|(cd2)|(cd 2)", 0) Then $sPart = " Part 2" ElseIf StringRegExp($sPart, "(?i)(pt 1)|(pt1)|(part1)|(part 1)|(cd1)|(cd 1)", 0) Then $sPart = " Part 1" ElseIf StringRegExp($sPart, "(?i)(pt 0)|(pt0)|(part0)|(part 0)|(cd0)|(cd 0)", 0) Then $sPart = " Part 0" ElseIf StringRegExp($sPart, "(?i)(pt 3)|(pt3)|(part3)|(part 3)|(cd3)|(cd 3)", 0) Then $sPart = " Part 3" ElseIf StringRegExp($sPart, "(?i)(pt 4)|(pt4)|(part4)|(part 4)|(cd4)|(cd 4)", 0) Then $sPart = " Part 4" ElseIf StringRegExp($sPart, "(?i)(pt 5)|(pt5)|(part5)|(part 5)|(cd5)|(cd 5)", 0) Then $sPart = " Part 5" Else $sPart = "" EndIf Return StringTrimRight($sTest, StringLen($sTest) - $iPos) & $sPart Else Local $aInfo = _IMDB_Search($sTest) If IsArray($aInfo) Then If $aInfo[1][1] <> "" Then $sTest &= " " & $aInfo[1][1] EndIf Return $sTest EndIf EndFunc ;==>_TrimAfterYear*EditOkay, I finally admit it. I can be bad about asking for help without providing adequate information.The above function is used to format filenames.If I was to run this string ("Wanted 2008 anything after it") through this function then the "anything after it"would be removed. This can be problematic if I were to run lets say two files that have identical names aside from the named number suffix "cd1, cd2, part1, part2" and so on.i.e. A video split in half - The Avengers 2012 cd1 and The Avengers 2012 cd2 once the file names were run through this function they both would return as "The Avengers 2012." + extension. If you use AutoIt's renaming function - FileMove with the overwrite param than BAM! you overwrite one of the files thus reason to include defensive programming. Like I said the function works but I'd rather do the RegEx check inside of a loop because it requires less lines of code and is neat aka tidy folks. When using known method to attempt at making this process iterative the RegEx will fail. Try it, Buy It than take it back because its the same test string using different digits referenced by variables. If this isn't a bug or limitation than I'm confused. Edited November 19, 2012 by Decipher Spoiler Link to comment Share on other sites More sharing options...
Decipher Posted November 19, 2012 Author Share Posted November 19, 2012 (edited) The title should have been Iterative problem with function. Func _TrimAfterYear($sTest) Local $aMatch = StringRegExp($sTest, "d{4}", 1) If IsArray($aMatch) Then Local $iPos = StringInStr($sTest, $aMatch[0]) + 3 Local $sPart = StringMid($sTest, $iPos) For $i = 1 To 10 If StringRegExp($sPart, "(?i)(pt " & $i & ")|(pt" & $i & ")|(part" & $i & ")|(part " & $i & ")|(cd" & $i & ")|(cd " & $i & ")", 0) Then $sPart = " Part " & $i ExitLoop Else $sPart = "" EndIf Next Return StringTrimRight($sTest, StringLen($sTest) - $iPos) & $sPart Else Return $sTest EndIf EndFunc ;==>_TrimAfterYear The function should rename "anything 2012 cd1" to "anything 2012 Part 1" Edited November 19, 2012 by Decipher Spoiler Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 19, 2012 Moderators Share Posted November 19, 2012 Dechipher,The edit the first post and select the "Use Full Editor]" option - that opens the title for editing as well. m23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Decipher Posted November 19, 2012 Author Share Posted November 19, 2012 (edited) Thanks again. I quess you don't scan all new posts and topics for your name then.... Edited November 19, 2012 by Decipher Spoiler Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 19, 2012 Moderators Share Posted November 19, 2012 Decipher,I quess you don't scan all new posts and topics for your name then....No, I use a much more sophisticated algorithm than that. M23 Decipher 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 19, 2012 Moderators Share Posted November 19, 2012 Decipher,Looking at the question you posed I am still unsure what it is you are trying to do. The example you give:The function should rename "anything 2012 cd1" to "anything 2012 Part 1"can be solved with a simple StringReplace.Can you give us a list with examples of all the likely names and what you want them to be converted into afterwards - then we can work up a suitable pattern for a RegEx. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Decipher Posted November 19, 2012 Author Share Posted November 19, 2012 (edited) It may not always be "cd1" that needs to be replaced. The following strings could be present:(cd, pt, part) Naming Conventions. I'm trying to make it comprehensive. There could be either a space between the "cd" and digit or not.Consider the following file names:*Editcd1, cd 1, pt 1, pt1, part1, part 1 where 1 could be any singe digit.*End of EditIce Age 4 Continental Drift 2012 xvid avi 1080p ac3 part 1.avi - Result: Ice Age 4 Continental Drift 2012 Part 1.avi Ice Age 4 Continental Drift 2012 xvid avi 1080p ac3 part 2.avi - Result: Ice Age 4 Continental Drift 2012 Part 1.avi John Carter 2012 bluray 720p aad bla cd1.avi - Result: John Carter 2012 Part 1.aviJohn Carter 2012 bluray 720p aad bla cd2.avi - Result: John Carter 2012 Part 2.avi Ramona And Beezus 2010 bluray 720p aad bla pt 1.avi - Result: Ramona And Beezus 2010 Part 1.aviRamona And Beezus 2010 bluray 720p aad bla pt 2.avi - Result: Ramona And Beezus 2010 Part 2.aviIf I remove everything after the year than the "pt2" suffix would be removed also. I need to check for that so I won't overwrite theprevious file that also has the same name.The functions above check to see if there a 4 digits in the string if so it finds the position of the alleged year and removes everything after it. I won't to detect if there is a "part " & $Digit in the filename before this happens than after the trim add it back. Edited November 19, 2012 by Decipher Spoiler Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 19, 2012 Moderators Share Posted November 19, 2012 Decipher,Not too hard: Global $aList[8] = ["Ice Age 4 Continental Drift 2012 xvid avi 1080p ac3 part 1.avi", _ "Ice Age 4 Continental Drift 2012 xvid avi 1080p ac3 part 2.avi", _ "John Carter 2012 bluray 720p aad bla cd1.avi", _ "John Carter 2012 bluray 720p aad bla cd2.avi", _ "John Carter 2012 bluray 720p aad bla cd 1.avi", _ "John Carter 2012 bluray 720p aad bla cd 2.avi", _ "Ramona And Beezus 2010 bluray 720p aad bla pt 1.avi", _ "Ramona And Beezus 2010 bluray 720p aad bla pt 2.avi"] For $i = 0 To 7 $sNew_Name = StringRegExpReplace($aList[$i], "(?i)(?U)(.*dddd).*(part|pt|cd)s?(d)(..*)", "$1 Part $3$4") ConsoleWrite($sNew_Name & @CRLF) NextSRER decode:(?i) - Case Insensitive (?U) - Not greedy (.*dddd) - Capture all characters up to and including 4 digits - this should be the date = stored as $1 .* - Ignore all characters up to (part|pt|cd) - Capture either of these possibilities = stored as $2 s? - Ignore a possible space (d) - Capture the next digit = stored as $3 (..*) - Capture a dot and any following characters = stored as $4 Replace with $1 Part $3$4 - Recreate using the stored parts and some free textWe need the (?U) as you have the "1080" in some of the original titles and so we need to look for the first instance (presumably the date) and not the last instance of 4 digits. All clear? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Decipher Posted November 19, 2012 Author Share Posted November 19, 2012 Melba23, Yes, perfectly Thanks Spoiler Link to comment Share on other sites More sharing options...
Decipher Posted November 19, 2012 Author Share Posted November 19, 2012 (edited) Could a SRER be written to replace this function as well? Func _FirstLetterCapitals($sTest) Local $sFirstChar If StringRegExp($sTest, "\s") Then Local $aMatch = StringSplit($sTest, " ") For $iString = 1 To $aMatch[0] Step 1 If $aMatch[$iString] <> "" Then $sFirstChar = StringMid($aMatch[$iString], 1, 1) If StringRegExp($sFirstChar, "[a-z]", 0) Then $aMatch[$iString] = StringReplace($aMatch[$iString], StringLower($sFirstChar), StringUpper($sFirstChar), 1) EndIf EndIf Next Return _ArrayToString($aMatch, " ", 1) Else $sFirstChar = StringMid($sTest, 1, 1) Return StringReplace($sTest, StringLower($sFirstChar), StringUpper($sFirstChar), 1) EndIf EndFunc ;==>_FirstLetterCapitals Function capitalizes the first letter in all words contained in a string. I know I'm just being greedy now A simple yes of no will suffice. Thanks. Edited November 19, 2012 by Decipher Spoiler Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 19, 2012 Moderators Share Posted November 19, 2012 Decipher,Have you looked at _StringProper in the Help file? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kylomas Posted November 19, 2012 Share Posted November 19, 2012 (edited) Decipher, Look at function stringproper in help file. kylomas edit: too quick, M23...giong to school on that SRER you wrote! Edited November 19, 2012 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Decipher Posted November 19, 2012 Author Share Posted November 19, 2012 (edited) LOL, Thanks guies. *Edit I replaced my function with _StringProper with negative results. Video: Madea's Witness Protection Program PT2 698 MB Type: AVI !>Moved: "Madea'S Witness Protection Program Pt2.avi" to F:VideoAVI Just incase anyone ever has a use for the function. Edited November 19, 2012 by Decipher Spoiler Link to comment Share on other sites More sharing options...
BrewManNH Posted November 19, 2012 Share Posted November 19, 2012 If you want a Title (or Start) Case function, and not a Proper function, this is probably more to your liking. Doesn't work well with Unicode in all cases.expandcollapse popup$String = "'she's all 'that' I,wAnt(" & '1st "disk" of 2)' ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : _StringTitleCase($String) = ' & _StringTitleCase($String) & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console ; #FUNCTION# ==================================================================================================================== ; Name...........: _StringTitleCase ; Description ...: Changes a string to title case ; Syntax.........: _StringTitleCase($s_String) ; Parameters ....: $s_String - Input string ; Return values .: Success - Returns titlecased string. ; Failure - Returns "". ; Author ........: Jos van der Zande <jdeb at autoitscript dot com> ; Modified.......: BrewManNH ; Remarks .......: This function will capitalize the first character of every word. Modified _StringProper to a titlecase ; function instead of a Proper function. Not Unicode compatible. ; Related .......: _StringProper ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _StringTitleCase($s_String) ; modified _StringProper function, correctly capitalizes after ' and numbers Local $iX = 0 Local $CapNext = 1 Local $s_nStr = "" Local $s_CurChar For $iX = 1 To StringLen($s_String) $s_CurChar = StringMid($s_String, $iX, 1) Select Case $CapNext = 1 If StringRegExp($s_CurChar, "[a-zA-ZxC0-xFF0-9]") Then $s_CurChar = StringUpper($s_CurChar) $CapNext = 0 EndIf Case Not StringRegExp($s_CurChar, "[a-zA-ZxC0-xFF'0-9]") $CapNext = 1 Case Else $s_CurChar = StringLower($s_CurChar) EndSelect $s_nStr &= $s_CurChar Next Return $s_nStr EndFunc ;==>_TitleCaseStringIf you use _StringProper with words with apostrophes (Joe's, they're, etc.), the capitalization is a little odd looking. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Decipher Posted November 19, 2012 Author Share Posted November 19, 2012 BrewManNH, Thanks, I'll be using that function for sure. Spoiler Link to comment Share on other sites More sharing options...
Decipher Posted November 19, 2012 Author Share Posted November 19, 2012 Any ideas why the RegEx check fails when inside a loop and the digits repaced with a variable? In my initial post the function works but the latter dosen't. Not that it really matters now. Spoiler Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 19, 2012 Moderators Share Posted November 19, 2012 Decipher, This modified version using a varible works fine for me: Global $aList[8] = ["Ice Age 4 Continental Drift 2012 xvid avi 1080p ac3 part 1.avi", _ "Ice Age 4 Continental Drift 2012 xvid avi 1080p ac3 part 2.avi", _ "John Carter 2012 bluray 720p aad bla cd1.avi", _ "John Carter 2012 bluray 720p aad bla cd2.avi", _ "John Carter 2012 bluray 720p aad bla cd 1.avi", _ "John Carter 2012 bluray 720p aad bla cd 2.avi", _ "Ramona And Beezus 2010 bluray 720p aad bla pt 1.avi", _ "Ramona And Beezus 2010 bluray 720p aad bla pt 2.avi"] For $i = 0 To 7 $sNew_Name = _TrimAfterYear($aList[$i]) ConsoleWrite($sNew_Name & @CRLF) Next Func _TrimAfterYear($sTest) Local $aMatch = StringRegExp($sTest, "d{4}", 1) If IsArray($aMatch) Then Local $iPos = StringInStr($sTest, $aMatch[0]) + 3 Local $sPart = StringMid($sTest, $iPos) For $i = 0 To 5 If StringRegExp($sPart, "(?i)(pt |pt|part|part |cd|cd )" & $i) Then $sPart = " Part " & $i ExitLoop EndIf Next Return StringTrimRight($sTest, StringLen($sTest) - $iPos) & $sPart Else Local $aInfo = _IMDB_Search($sTest) If IsArray($aInfo) Then If $aInfo[1][1] <> "" Then $sTest &= " " & $aInfo[1][1] EndIf Return $sTest EndIf EndFunc ;==>_TrimAfterYear You can shorten the RegEx to this if you separate out the optional space: StringRegExp($sPart, "(?i)(pt|part|cd)s?" & $i) M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Decipher Posted November 19, 2012 Author Share Posted November 19, 2012 (edited) One more question please. If I use this $sTest = StringRegExpReplace("Alphas S02E02 Part 1", "(?i)(part|pt|cd)s?(d)|(?i)(s(d){2})(e(d){2})", "") to remove "S02E02 Part 1" to perform a IMDB lookup for the missing year using the string "Alphas" than why when I use $aMatch = StringRegExp($sTest, "(?i)(part|pt|cd)s?(d)|(?i)(s(d){2})(e(d){2})", 1) to store the "S02E02 Part 1" beforehand to be restored after the search and after the addition of the year, will the array only contain: [0]| [1]| [2]|S02 [3]|2 [4]|E02 [5]|2 Which is missing "Part 1" and contains two extra digits where the output becomes: "Alphas 2011 S02 2 E02 2" expandcollapse popup_TrimAfterYear("Alphas S02E02 part 1") Exit Func _TrimAfterYear($sTest) If Not StringRegExp($sTest, "(.*dddd)") Then Local $aMatch = StringRegExp($sTest, "(?i)(part|pt|cd)s?(d)|(?i)(s(d){2})(e(d){2})", 1) If Not @error Then $sTest = StringRegExpReplace($sTest, "(?i)(part|pt|cd)s?(d)|(?i)(s(d){2})(e(d){2})", "") _ArrayDisplay($aMatch) MsgBox(0, "", $sTest) EndIf Local $aInfo = _IMDB_Search($sTest) If $aInfo[1][1] <> "" Then $sTest &= $aInfo[1][1] If IsArray($aMatch) Then $sTest &= " " & _ArrayToString($aMatch, " ") ConsoleWrite( $sTest) EndIf EndIf Return StringRegExpReplace($sTest, "(?i)(?U)(.*dddd).*(part|pt|cd)s?(d)(..*)", "$1 Part $3$4") EndFunc ;==>_TrimAfterYear Func _IMDB_To_Array($sString) Local $sStart_Suffix = ':"', $sDelim = '"', $aTemp_Array Local $aInfo[4][2] = [["Title", ''],["Year", ''],["Plot", ''],["Poster", '']] For $i = 0 To 3 If $i = 3 Then $aTemp_Array = _StringBetween($sString, 'http://', '.jpg') If IsArray($aTemp_Array) Then $aInfo[$i][1] = 'http://' & $aTemp_Array[0] & '.jpg' ContinueLoop EndIf $aTemp_Array = _StringBetween($sString, $aInfo[$i][0] & $sDelim & $sStart_Suffix, $sDelim) If IsArray($aTemp_Array) Then $aInfo[$i][1] = $aTemp_Array[0] Next Return $aInfo EndFunc ;==>_IMDB_To_Array Func _IMDB_Search($sEncoded_String) Local $sSearchData = _GetSourceCode("http://omdbapi.com/?t=" & $sEncoded_String) If $sSearchData = "" Then Return SetError(1, 0, 0) Else ;MsgBox(0, "", $sSearchData, 1) Return _IMDB_To_Array($sSearchData) EndIf EndFunc ;==>_IMDB_Search Func _GetSourceCode($sUrl) Return BinaryToString(InetRead($sUrl Endfunc Edited November 19, 2012 by Decipher Spoiler Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 19, 2012 Moderators Share Posted November 19, 2012 Decipher,You really need a class in "How to ask a question", because you certainly do not make your requests clear at present! A general point: the first question you need to ask is "Do I need an SRE to do this?". SREs are powerful, but are not the answer to every problem - as their name suggests you do need some form of pattern to use them and often there is not one. Now turning to your post: do you have many names with the "S02E02 Part 1" ending - or is it just this one? If there are many then we can work on an SRE - if it is just this one then simpler String* functions are probably better suited. And why are you getting the SRE to return an array where you want a string? Ready to help when I can get some sensible information on which to work. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Decipher Posted November 19, 2012 Author Share Posted November 19, 2012 (edited) Melba23,What RegEx would I use to match "S01E01"?How can I return the matched string as a string. Edited November 19, 2012 by Decipher Spoiler Link to comment Share on other sites More sharing options...
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