I'm trying to parse BBcodes in php but i don't think my code is safe at all.
$Text = preg_replace("(\[color=(.+?)\](.+?)\[\/color\])is","<span style=\"color: $1\">$2</span>",$Text);
I think you can pass an injection like this and it will work:
[color=<script>alert('gotcha');</script>]...[/color]
How to improve my regex to only capture the two standar color formats:
[color=red]...[/color] OR [color=#FF0000]...[/color]
Thanks