The ? needs to be inside the capturing parenths like (.+?). In your example (.+)? you have code that effectively reads the least ammount of greedy matches and as a result fails to DWIM.
In reply to Re: Re: Regex Question
by tachyon
in thread Regex Question
by cyocum
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |