MyBB Community Forums

Full Version: Supercript MyCode
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I know there is a mycode for superscripts and i have it installed on my forum

I want a mycode to automatically convert something like that

x^3 + x^2 - x = 0

I want the "^3" to be replaced to "<sup>3</sup>"

I don't know how to add the Mycode
Go to Admin CP > Configuration > MyCode > Add New MyCode >

Title: Superscript

Regular Expression:
 \[sup\](.*?)\[/sup\] 

Replacement:
 <sup>$1</sup> 

Enabled? : Yes

Save it!
(2010-06-27, 04:22 AM)E-Hero Kyle Wrote: [ -> ]Go to Admin CP > Configuration > MyCode > Add New MyCode >

Title: Superscript

Regular Expression:
 \[sup\](.*?)\[/sup\] 

Replacement:
 <sup>$1</sup> 

Enabled? : Yes

Save it!
Thanks but i already have this one.
Can't we have a mycode with only ^x?
To make superscript like that? Nope, that is the only superscript I know
(2010-06-27, 07:48 AM)E-Hero Kyle Wrote: [ -> ]To make superscript like that? Nope, that is the only superscript I know
Ok thanks
There must be a way to identify "^3" dunno how though.
Regex: ([\d\w]+)\^(\d+)
Replacement: $1<sup>$2</sup>

replaces: numbers/letters^numbers
thanks infinitely mate Smile
Wonderful
thanks..
Or you could try:
Regular Expression:
\[(.*?)\^(.*?)\]

Replacement:
$1<sup>$2</sup>

but here, you will have to write the code like this:
[x^3]
i.e with square brackets in beginning and end