Jump to content

Escaping BBtags


russy

Recommended Posts

I'm making a script that uses BBtags. I'll do my best to explain my problem.

 

Lets say we have a user named: bob[hi]yay\

 

If you have that username, in a lot of forums it tends to cause a problem, such as:

yay\]test

 

Basically I want to have it so you can escape the [ ] and \ characters, and regular expression will pick up on whats escaped and whats not. I have a basic understanding of regular expressions, and heres my older code that ignores escaping characters:

 

$parse['data'] = preg_replace("{\[{$bbtag['tag']}=(.+?)\](.+?)\[/{$bbtag['tag']}\]}sei", "\$this->bbtag({$bbtag['id']}, '\\2', '\\1')", $parse['data']);

 

The thing is it has to ignore a \], however NOT ignore a \\] which is the problem for me. Any help would be great, thank you.

Link to comment
https://forums.phpfreaks.com/topic/110701-escaping-bbtags/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.