I have the following string: "AZS40G is Alumina Zircon Silicate material with ZrO2 content of 39% minimum, which serves as a great substitute in applications for production of sintered AZS refractories and where the Fused Zircon mullite is required. C1R5".
I would like to use regex to find all digits in chemical formulas in the text (Instances of letters preceding numbers, excluding the designates abbreviation i.e. "AZS40G" in this instance and wrap them with a <sub></sub>
tag.
I am doing this all in php and since I do not know where to start with regex, I have provided the following pseudo code/php example:
$text = "AZS40G is Alumina Zircon Silicate material with ZrO2 content of 39% minimum, which serves as a great substitute in applications for production of sintered AZS refractories and where the Fused Zircon mullite is required. Zr5O2, M20R2, C1R5";
preg_replace('/(AZS40G!)(?<=[A-Z])\d+/', '<sub>${1}</sub>', $text);
The expected result would be all instances as follows:
I have the following string: "AZS40G is Alumina Zircon Silicate material with ZrO2 content of 39% minimum, which serves as a great substitute in applications for production of sintered AZS refractories and where the Fused Zircon mullite is required. C1R5".