Thread: What a regex is
View Single Post
Old 05-05-2010, 11:38 AM   #8
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by kovidgoyal View Post
Have (name, regex pairs) where name is something descriptiove like
Title - author - series - series_index
Have a few predefined regexes with useful names like that.
Allow the user to define new (name, regex) pairs either by modifying the builtin ones or writing them from scratch.
That's exactly what I think would work well. The code for saved searches might be adaptable for this job.

Another consideration might be: to make the stored combination a triplet:
(name, regex, sample filename to test) so that it stores a sample filename, too.

The regex "name" could be the sample filename, except that the string you are testing has to have a number in the series_index and an extension (.txt, etc.) for it to work.

I find myself having to constantly copy and paste in a sample filename, even though my regex is very flexible and probably handles it. I need to test even though 90% of the time I don't actually have to change the regex and don't need the history function. (At this point, I almost need a history of tested filenames more than a history of regexes.) Just remembering the last few tested filename strings would make testing against the regex faster and easier.

Note: on thinking about the idea of triplets and stored filename strings, it might be confusing if a filename string was stored against a regex that didn't properly decode it. Still, I'd prefer that, and make sure I didn't store "wrong filenames" against a regex, but I'd settle for a simple history of sample filenames to test against that I could call up and quickly edit to test and verify the regex.
Starson17 is offline   Reply With Quote