Need a bit of help concerning RegEx
-
I own few virtual pinball files that I need to be clean up. I was planning to use RegEx in Excel to clean them out, I'm ok with VBA programming I know what RegxEx is and what it can do but I'm not familiar on how to write them Can you help me with those ? Here is an example of the files and the suggested RegEx "\(.*\).*(?=\[0-9a-zA-Z\.]+\.vpx)": F:\vPinball\VisualPinball\Tables\Cross Town (Gottlieb 1966).vpx F:\vPinball\VisualPinball\Tables\Wild Fyre (Stern 1978) 1.1.vpx F:\vPinball\VisualPinball\Tables\Pirates of the Caribbean Siggis Mod 1.0.vpx F:\vPinball\VisualPinball\Tables\Punk wip 12.vpx F:\vPinball\VisualPinball\Tables\Attack from Mars (Bally1995) g5k 1.1.vpx F:\vPinball\VisualPinball\Tables\Flying Chariots (Gottlieb 1963).vpx F:\vPinball\VisualPinball\Tables\Lady Luck (Bally 1986) 1.1.vpx F:\vPinball\VisualPinball\Tables\Fathom (Bally 1981) 1.1a.vpx F:\vPinball\VisualPinball\Tables\Conan (Rowamet 1983) v1.1a.vpx F:\vPinball\VisualPinball\Tables\Black Knight - Sword Of Rage.vpx F:\vPinball\VisualPinball\Tables\Heat Wave (Williams 1964).vpx F:\vPinball\VisualPinball\Tables\Full (Recreativos Franco 1977).vpx Ideally the expected name will be Back To The Future.vpx by example Someone did suggested me this RegEx mentionned earlier, which did most of the cleaning but after running the VBA there a still few that weren't cleaned Here are those: Back To The Future 1.4 PF Mod.png Back To The Future 1.4 PF Mod_thumb.png Back To The Future 1.4 PF Mod_thumb_sm.png Back to the Future 1.05 .png Back to the Future 1.06 .png Back to the Future 1.14.png Back to the Future 1.15.png back to the future 2 mf.png back to the future mf.png Back To The Future Starlion MoD.png Back To The Future Starlion MoD_thumb.png Back To The Future Starlion MoD_thumb_sm.png Ideally I was looking for Back To The Future.png Can you help me please ? Thanks
-
I own few virtual pinball files that I need to be clean up. I was planning to use RegEx in Excel to clean them out, I'm ok with VBA programming I know what RegxEx is and what it can do but I'm not familiar on how to write them Can you help me with those ? Here is an example of the files and the suggested RegEx "\(.*\).*(?=\[0-9a-zA-Z\.]+\.vpx)": F:\vPinball\VisualPinball\Tables\Cross Town (Gottlieb 1966).vpx F:\vPinball\VisualPinball\Tables\Wild Fyre (Stern 1978) 1.1.vpx F:\vPinball\VisualPinball\Tables\Pirates of the Caribbean Siggis Mod 1.0.vpx F:\vPinball\VisualPinball\Tables\Punk wip 12.vpx F:\vPinball\VisualPinball\Tables\Attack from Mars (Bally1995) g5k 1.1.vpx F:\vPinball\VisualPinball\Tables\Flying Chariots (Gottlieb 1963).vpx F:\vPinball\VisualPinball\Tables\Lady Luck (Bally 1986) 1.1.vpx F:\vPinball\VisualPinball\Tables\Fathom (Bally 1981) 1.1a.vpx F:\vPinball\VisualPinball\Tables\Conan (Rowamet 1983) v1.1a.vpx F:\vPinball\VisualPinball\Tables\Black Knight - Sword Of Rage.vpx F:\vPinball\VisualPinball\Tables\Heat Wave (Williams 1964).vpx F:\vPinball\VisualPinball\Tables\Full (Recreativos Franco 1977).vpx Ideally the expected name will be Back To The Future.vpx by example Someone did suggested me this RegEx mentionned earlier, which did most of the cleaning but after running the VBA there a still few that weren't cleaned Here are those: Back To The Future 1.4 PF Mod.png Back To The Future 1.4 PF Mod_thumb.png Back To The Future 1.4 PF Mod_thumb_sm.png Back to the Future 1.05 .png Back to the Future 1.06 .png Back to the Future 1.14.png Back to the Future 1.15.png back to the future 2 mf.png back to the future mf.png Back To The Future Starlion MoD.png Back To The Future Starlion MoD_thumb.png Back To The Future Starlion MoD_thumb_sm.png Ideally I was looking for Back To The Future.png Can you help me please ? Thanks
The reason they are left behind is because your Regex only includes filenames that contain the text ".vpx" - which your .png files don't, so can't be matched or removed. Do two things: 1) Get a copy of Expresso[^] - it's free, and it examines and generates Regular expressions. 2) Learn how regexes work: Regular Expression Tutorial - Learn How to Use Regular Expressions[^] I'm not going to suggest a regex at all - I have no idea what else is in the folder(s) or how you collected them and no way to find that out - a "random" regex" would be likely to delete a lot more than you actually wanted with no way to test it before you used it!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!