XF 1.5 Having Difficulty with BB Option Match Regular Expression

Eoj Nawoh

Active member
Hello,

Please forgive me if I'm missing something. I have made a custom BB Code that is supposed to only accept numbers.

For instance, you'll put something like [mycode]1023982323[/mycode] and it takes that number and uses it for a HTML class.

Whoever, there seems to be an issue in that, I'm unable to get regex to only allow numbers under Custom BB Code.

Currently my Option Match Regular Expression has:
(/\d+/) and I've also tried /\d+/

Neither of these worked. I will be honest, I have very little familiarity with regex for PCRE.

Would anyone be able to help me with this?
 
Last edited:
The matching here is specifically for the {option} part, not the {text} part. If you need to do text-part validation, it has to be done in a callback. (There isn't any parse-time matching of that.)
 
The matching here is specifically for the {option} part, not the {text} part. If you need to do text-part validation, it has to be done in a callback. (There isn't any parse-time matching of that.)
Question, if I made the {option} be the number, and just had text work. Would the regex and BB code work then?
 
As in:
Code:
[mycode=1234]...[/mycode]
If you approach it like that, then you can specify a regex. You likely want:
Code:
/^\d+$/
As the regex.
 
Top Bottom