I have a string like "-UK 123 123-UK 123-UK 123-UK" where I want to match all '123-UK' repetitions (in the real problem the repetitions could be any number). I was wondering if someone could enlighten me why these two expressions do not give the same results when evaluating $1:
/((?:\d+-UK\W?)+)/The former works (giving $1 as "123-UK 123-UK 123-UK") but the latter does not ($1 is null). In the later expression the '*' makes the group optional, but since the group exists I would expect it to match.
Many thanksIn reply to Regular expression * vs + by b_e_n_82
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |