我有下面的語句PHP - 正則表達式的作品不一致
echo preg_replace("/(?<=\d)(th|rd|st|nd)([^0-z])/i","<sup>$1</sup>$2","some text 1st<br />\n2nd<br />\n3rd<br />\n4th 5th 21nd 33rd 41st<br />\nsome text");
它輸出
some text 1st<br />
2nd<br />
3rd<br />
4<sup>th</sup> 5<sup>th</sup> 21<sup>nd</sup> 33<sup>rd</sup> 41st<br />
some text
我只是無法弄清楚如何使它環繞屆,第三屆,ST或ND在所有情況下都帶上標籤。
究竟是什麼你想要做的,什麼是你期望的輸出是什麼? –
你是什麼'it' – Anirudha
我爲什麼被低估? – L84