MyBB Community Forums

Full Version: multiples variables
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, i like to use many variables in one custom code.
like this

[mycode]title , name , number [/mycode]

result:

$1

your name is $2
your number is $3

have one way to do this ?

thanks for help me !!
[mycode title=([a-z0-9]+) number=([0-9]+)]([a-z0-9]+)[/mycode]

replace (.*?) with what mybb uses as the way of changing the codes to actual string.

i am sure it uses regular regex tho.

you didn't go into details what you wanted so i give you the basic regex style.

([#a-z0-9]+) alpha-numeric
(.*?)=allows all ( not a good idea tho)
([0-9]+)=numbers only (good for fields where numbers only )

there is more but i really do not have the patience to list them all.


best to use how i got it set up.

someone can make the last part more secure it be good to go.
thanks how do you make them optional? i think in that example, you need all the fields