I'm struggling to get the right regex to match the following;
content/foo/B6128/8918/foo+bar+foo
OR
content/foo/B6128/8918/foo+bar+foo/randomstringnumsletters
I'm sure this isn't that complicated and I'm nearly there, just can't get it perfected. Here's what I've tried;
content\/(\w+)\/(\w+)\/(\d+)\/([^\/]+[\w]+)\/?(\w*)$
using this online tester: http://regex101.com/r/sB8rR5/2
It still matches a 5th item with this string content/foo/B6128/8918/foo+bar+foo
;
And while technically this pattern does match either OR url structures. I don't want it to match the 5th item when there's no randomstringnumsletters
present.
After playing around with it for a bit, I do realise some elements are redundant with what I've tried, but I'm not getting anywhere with it...