|Don't ask to ask, just ask|
ilcylic's scratchpadby ilcylic (Scribe)
|on Jun 04, 2004 at 18:05 UTC||Need Help??|
23 Feb 2013
I've got a file with a bunch of lines that look like so:
Honda CB1000 1995 26 47 15 99-3520-5 30 55 17 99-3519-5
and some lines that look like:
Yamaha YZF-R1 Limited edition 2006 30 47 12 99-3540-5 30 55 17 99-3519-5
I'm trying to grab everything up to and including the year.
Thus far I have
which fails on the lines that have the "extra stuff" after the model name, and before the year.
I suppose I don't need the [^\s]*\s*[^\s]*\s* though I was working on the "say what you really really mean in regex" principle there.
What I need to say in regex is "Match things which are not four digits followed by some amount of whitespace followed by two more digits".
(Note the addition of \s+ inside the positive lookahead assertion.)