I’ve tried to do this but I just suck at regular expressions. What I need is to have a regular expression that will replace 1st, 3rd and 9th with 1st, 3rd and 9th by adding <sup> and </sup> around any ‘rd’ ‘th’ and ‘st’ that is preceded by a number and not followed by a letter or a number.
I’ve tried to do this but I just suck at regular expressions. What I
Share
This is trivial, so I shall just give you the components you need.
(?<=\d)checks for the presence of a number immediately before the current position.(A|B|C)checks for any of the regexes A, B or C in the current position.And that’s all you need.