Hi there, I'm looking for a (= the best) way to replace [ b ]Some text[ / b ] (without spaces) by <b>Some text</b>.
I've tried these two:
# no. 1
$to_edit =~ s/\[b\](.*)\[\/b\]/\<b>$1\<\/b>/isg;
# no. 2
$to_edit =~ s/\[b\]/\<b>/isg;
$to_edit =~ s/\[\/b\]/\<\/b>/isg;
the firstone only takes the first [ b ] and the last [ / b ], so [ b ]This is bold[ / b ], this not, [ b ]This again [ / b ]
will turn out in <b>This is bold[ / b ], this not, [ b ]This again </b>
And the problem with the second one is it is possible to only include [ b ] and so make the rest of the page Bold
. wich I don't want my users to be able to.
I hope you understand my problem and maybe even have a solution