in reply to regexp problem using custom markup

Try @colors = $new =~ m/(\[color=.*?\])/gi; Adding the '?' makes the regex non-greedy. When it's greedy, it will merrily swallow everying until it reaches the last ']' in the target string.