That’s because * is a greedy quantifier, trying to match as much as it can. Make it *?:
q=http://.*?\.doc
More information can be found in the Regular Expression HOWTO:
Greedy versus Non-greedy
That’s because * is a greedy quantifier, trying to match as much as it can. Make it *?:
q=http://.*?\.doc
More information can be found in the Regular Expression HOWTO:
Greedy versus Non-greedy