I have a few questions about regex and the database.
I have noticed than in my old phpBB forum, every bbcode field in the database was automatically filled with regular expressions : first_pass_match, first_pass_replace, second_pass_match, second_pass_replace.
In the new version the "replace" fields are empty and the "match" fields contains "/(?!)/" .
The BBcode I'm currently doing is like this:
Code: Select all
[gallery={INTTEXT1} ipl={NUMBER1} thumb={NUMBER2}]{INTTEXT2}[/gallery]
NUMBER1 contains a number/integer
NUMBER2 contains a number/boolean
INTTEXT2 contains a list of images separated with a comma.
I made a javascript code which transforms all this into proper html and it works.
There is something that bothers me though, if there is a line break in the image list (INTTEXT2), the bbcode doesn't work, it just displays as is as long as I don't find and manually remove the line break. I thought maybe by using the first_pass_match/first_pass_replace fields in the database I could automatically get rid of the line breaks, but since the old regexes from the previous phpBB versions don't seemed to be used anymore in the new version, I'm not sure if it's the right approach or if it would even work? If it would, I need help with the syntax.
I found this in an old bbcode:
first_pass_match:
Code: Select all
!\[test\](.*?)\[/test\]!ies
Code: Select all
'[test:$uid]'.str_replace(array("\r\n", '\"', '\'', '(', ')'), array("\n", '"', ''', '(', ')'), trim('${1}')).'[/test:$uid]'