lucy24 - 12:58 pm on Jan 2, 2013 (gmt 0)
What the bleep bleep? An URL will never contain literal spaces* so what's this set supposed to capture? Or rather, what's it meant to exclude? There's no point in excluding something that would never occur anyway: it's just like saying .+ which is Not A Good Idea. Especially not three separate times, two of them non-final.
It will be much more useful if you give some sample URLs, or explain your naming pattern, so we can see what kinds of material come in those mystery areas:
Once you know what kind of text can and can't occur in those places, you can start on a workable rule. I assume it's something more complicated than [^-]+ or you would have said so.
And if you mean that the whole components like
are optional, then your rule needs a lot more parentheses and question marks.
* Unless, ahem, you have been Very Unwise in your naming.