I have a problem that sounds very simple at first:
I need to match single digits in a string, but leave out sequences made up of more than one consecutive digits.
The issue is: I build an online dictionary using php/mysql. I use html encoding for the dictionary. Examples:
(First the string stored in database then how it should look on the webpage)
autorizált kereskedő (shown on the webpage as autorizált kereskedÅ‘)
SZISZ1 (shown on the webpage as SZISZ1)
SZISZ2 I. (shown on the webpage as SZISZ2 I.)
I need to match the 1 and 2 from the words "SZISZ1" and "SZISZ1 I." to convert them to superscript but leave out the sequence 337 from the html encoding of special characters in other words. All special characters have a similar code in the database: "&#[0-9]{3}" and all single digits have the form "[0-9]{1}". My problem is that the regular expression used to find a single digit fires separately for each digit of a sequence of digits and it messes up how my special characters shown on screen.
Please do not tell me to store the superscript html tags in the database.
Your help will be greatly appreciated.
Thank you, Tihamer