MyBB Community Forums

Full Version: Fractions 3.0 Updated: 1/1/2010
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Version 3.0

New Title:
Fractions 3.0

New Regex:
(^|\s)(\d+)/(\d+)(sts|nds|rds|ths)?(\s|$)

New Replacement:
$1<sup>$2</sup>&frasl;<sub>$3$4</sub>


Outdated Below!

Fractions MyCode

Updated Version:
Regex:
\[f\](\d+)/(\d+)(sts|nds|rds|ths)?\[\/f\]

Replacement:
<sup>$1</sup>&frasl;<sub>$2$3</sub>


Outdated below

Regex
(\d+)/(\d+)

Replacement
<sup>$1</sup>&frasl;<sub>$2</sub>

Usage
17/93

This will create fractions as displayed here:
http://changelog.ca/log/2008/07/01/writi...ns_in_html
Update to the regex:
(\d+)/(\d+)(st|nd|rd|th)?

And the replacement:
<sup>$1</sup>&frasl;<sub>$2$3</sub>
I've updated this yet again because of compatibility issues with links that contain #/#.

New regex:
\[f\](\d+)/(\d+)(sts|nds|rds|ths)?\[\/f\]

This also corrects the qualifier text.
And I actually updated it again LOL!!!

So that it'll work in its original format, but not affect links and other things.

New Title:
Fractions 3.0

New Regex:
(^|\s)(\d+)/(\d+)(sts|nds|rds|ths)?(\s|$)

New Replacement:
$1<sup>$2</sup>&frasl;<sub>$3$4</sub>

I had this epiphany after I made the tagged version. To explain a little, this makes it so that it only works if its the start of a line OR a whitespace before the first number, and whitespace or the end of the line AFTER the second number or the qualifier.