Chimaera Posted December 13, 2012 Share Posted December 13, 2012 Going on from some previous work in another thread i started trying to write a regex Its obviously not working so ive come back to throw myself on your charity again. I have a number of archive files like this Video2Brain.Power-Workshops.Lab-Korrektur.in.Photoshop.7z.001and i wanted to amend the filename to this m6Dg9L_1V_6Hb5`A6n[2eW0Of6^O3Dd3D.7z.001So i wrote this but it doesn't work StringRegExpReplace($aFileList[$i], "(?i)([...].\(?!^7z.*))", $sRandom) I thought id got case insensitive / match any/ not match anything after .7z/ Replace with "m6Dg9L_1V_6Hb5`A6n[2eW0Of6^O3Dd3D" Where have i gone wrong? Many thanks If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 13, 2012 Moderators Share Posted December 13, 2012 Chimaera, This should do the trick: $sRandom = "m6Dg9L_1V_6Hb5`A6n[2eW0Of6^O3Dd3D" $sOldName = "Video2Brain.Power-Workshops.Lab-Korrektur.in.Photoshop.7z.001" $sNewName = StringRegExpReplace($sOldName, "(?i).*(.7z.*)", $sRandom & "$1") MsgBox(0, "New Name", $sNewName) SRER decode: .* - Any characterss until we (.7z.*) - Capture ".7z" followed by any other characters Replace it with $sRandom and the captured characters (.7z etc) 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...
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