 |
|
|
I have released a new version of the RegEx Tester tool. You can download it free from http://www.codeproject.com/KB/string/regextester.aspx and http://sourceforge.net/projects/regextester
With RegEx Tester you can fully develop and test your regular expression against a target text. It's UI is designed to aid you in the RegEx developing. It uses and supports ALL of the features available in the .NET RegEx Class.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Please correct the function to... from .... txtDirectory.Text = Path.GetDirectoryName(dlgOpen.FileName); to txtDirectory.Text = Path.GetDirectoryName(dlgOpen.FileName.ToString());
so it will function ok ======================= if (dlgOpen.ShowDialog() == DialogResult.OK) { txtDirectory.Text = Path.GetDirectoryName(dlgOpen.FileName.ToString()); }
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I already made in the past an article about file renaming which did not get much attention (see 'File rename using boost regex and boost file system'). That article was also about the use of Boost libraries like Boost.FileSystem and Boost.Regex.
Obviously your article uses c# and a 'sharper' GUI.
Wkr me
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
psyphen wrote: i like pancakes
Without maple syrup?
With respect, I must disagree. A quick look at middle management in just about any corporation shows that the dodo not only survived, it's reproducing in record numbers. Christopher Duncan
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi, Good learning article on using reg-ex, but do you know Rename Master (http://www.joejoesoft.com/rm.php) ? This is a really powerful file rename tool I often use.
Thanks for you article, Lbas
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I just have to say it 
I had recently written a similar app myself for a client who was scared of command lines. It seems that we took a similar approach; good to see that I am not as crazy as friend had told me when I said that I'd be using REs.
Cheers
My BlogA human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects. - -Lazarus Long
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
One of the things you might want to do when you're renaming those episodes is to change the folder structure in which they're stored. Correct me if I'm wrong, but it seems that's not currently supported.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
No its not i'm afraid, this is just for file names alone. Eventually i may update this to allow you to insert .net code in the replace window to do the replacement how you choose, it wouldnt be hard.
-- Real programmers don't comment their code. It was hard to write, it should be hard to understand.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
RenameIt has a slightly different interface, but has the same basic idea as well as a couple non-regex renaming features. The SourceForge project hasn't seen much activity in recent years, but the tool has been around in various versions and places since 1998.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Interesting, i haven't seen it before. Thats the problem with SF, many people create their project all gung-ho and excited, then when it doesnt get much interest they forget about it and never change it 
I'm sure if you looked you'd find 3 or 4 more of these around on SF in various stages of completion hehe.
-- Real programmers don't comment their code. It was hard to write, it should be hard to understand.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi, Looks like this is a great idea! Could you compile a 32bit version for us that are slower at changing to newer OS? or could you post the code for .NET 1.1?
Thanks, Daniel
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
The x86 version should be 32 bit, if it wont run, its probably something evil that vista did - so i'll recompile at work and then repost.
Doing .net 1.1 code would be a bit of a pain as its all done in VS2005 - would have to re-create the entire project.
-- Real programmers don't comment their code. It was hard to write, it should be hard to understand.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
The x86 works in XP but looks like I need to have .NET 2.0 to run it! Too bad, not ready to change yet... too many project on 1.1 at the moment!
Thanks for you help, Daniel
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Go ahead and install .net 2.0, it runs side by side with 1.1 just fine. You can have both versions installed. Additionally, 2.0 will run any 1.1 applications.
-- Real programmers don't comment their code. It was hard to write, it should be hard to understand.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
The spare tyre on my car takes up space that I could use for something else. But someday an event will occur and the spare tyre is the only thing that will help.
Your article handles a specific problem you had very well. While you may not use it everyday, it is the best tool for the job.
Well done,
Jef.
PS I like your endnote: "Real programmers don't comment their code. It was hard to write, it should be hard to understand."
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I mean, it's a good idea but why would you use regex for it? you can simply use the string.Contains method can't you?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
haha, exactly what Marc Clifton asked.
Ok, so consider you ripped some tv shows from some dvd's you own. Over the years however you changed the naming format you use from say Stargate SG-1 [6x09] Allegiance.avi to stargate.sg-1.s09e20.avi and for another show even criminal.minds.204.avi. If you wanted to standardise all of these so they showed up in Windows Media Centre in the same order, rather than all over the place you'd have to go and rename every single one.
Now consider you use this regex for finding: (?[\w\.\s-_]+?)(?:\s|\.)s?\.?(((?\d\d?)(?\d\d))|(\[0?(?\d+)x(?\d+)\])|(s0?(?\d+)e(?\d+))).*?\.avi
and then this regex for replacing: ${Name}.${Season}${Episode}.avi
Those 3 shows above are renamed to. Stargate SG-1.609.avi stargate.sg-1.920.avi criminal.minds.204.avi
You could then do one more regex on it to replace the spaces within episode 609's name to be "."s if you wanted.
Personally, i hate switching out dvd's to watch shows - they get scratched and exposed to the elements and such - eventually not working any more. Aussie law lets us make a digital copy of all our dvd's to prevent this, so i rip them to disk. I have around 1500 tv show episodes on my media PC so to standardise the names would be rather time consuming 
There would be no way to use string.Contains to find or replace file names and keep some of the original data when you consider the example above.
Hope this makes sense to you, its not just for simple find and replace, its for find and replace on a complex format where information may need to be moved around or at least kept
-- Real programmers don't comment their code. It was hard to write, it should be hard to understand.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Well, true, to be honest i was never really able to understand regular expressions, nor could i find any good documentation about them :\
Nice article btw.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
If you want some hands on practice to learn and test regex expressions, I've found this tool created by Dr Edmund Weitz is excellent: http://weitz.de/regex-coach/
It lets you throw any string of characters into one text box and play with regular expressions in a second box. Text is highlighted live as soon as it matches. It also supports replacement text and other more advanced regex stuff.
I'm not really an RTFM guy and need play with things to figure them out. Regex is one of those things I find particularly hard to visualize and something I really need to fiddle with a lot to get right (I need regex when I'm working with XPaths).
---------------- Derek Read
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |