I'm in the process of migrating content from phpBB to WordPress. I have suceeded up to the point of translating the bbcode into html.
The BBCode is complicated by an alphanumeric string that is injected into each tag.
A common post will contain text like so...
[url=url] Click here [/url:583ow9wo]
[b:583ow9wo] BOLD [/b:583ow9wo]
[img:583ow9wo] jpg [/img:583ow9wo]
I am inexperienced with Regular Expressions but believe this may be a way out, as I found some help from the following post https://stackoverflow.com/a/5505874/4356865 (use regex [/?b:\d{5}] ) but the regex in this instance will only remove the numeric characters from this example.
Any help appreciated.
Something like this will work for tags that have no attributes:
Matching a tag like url is easy enough
With tags that have attributes, they do different things with their attributes, and so it's probably easier to handle a tag like URL seperately from a tag like IMG.
For your replacing, the contents of the tags are in backreferences themselves so you can do something like this for the b/i/u tags.
For the url tag, it's something like this
I say that the dot/period matches any character in multiple places. It matches any character except newline. You can turn the newline modifier in your regex on by using the
"dotall"
modifiers
like this