Hm, Python 2.7 should understand ?? fine. But I'm not sure I understand what you mean by greedy... greedy is "match as much as possible, in a given string". It's not "match as many strings as possible".
I'm wondering if you want to say
^(?:\(stuff\))? ...
Here, the "(stuff)" is still optional and non-captured, but the regex should be looking for it specifically at the beginning of the string.
however, it's including the first + or @ prefaced text in the result...
So, you have strings:
Code:
(optional text) this is required text +oneWordOptional @OneWordOptional
and
Code:
this is required text +oneWordOptional @OneWordOptional
but also
Code:
+oneWordOptional @OneWordOptional this is required text
which you don't want to let match?
You may want to forbid those symbols explicitly when at the beginning then:
^[^+@]\w ...
*edit: I may be confused by your post, are you grabbing strings or atoms of a string?
Bookmarks