Yeah, didn't realize I was matching the wrong thing. Think I'm all set now.
Another related question. I need to replace "Hello", and I've been using preg_match and preg_replace to do this. I use match to get "Hello" which gets looked up in the database and stored into a string. I then use replace to replace "Hello" with what came from the database.
Is there a better way to do this, say with just preg_replace?
In Lua you can give a custom function for how to handle substitutions, which can avoid the two scans of the string. I don't remember if PHP has a similar function, but it might. Another option would be to match all three components ("[translate=…]", "Hello", "[/translate]") and then construct a new string by concatenating the first and third match with the DB's result in the middle.