在數據庫中有很多推文,我想用RT替換RT中的RT @username:... rest of tweet,但顯然只有在「 RT「代表推文的開頭。 (函數應該是不區分大小寫)每當字符串以「RT」開頭時,標籤
所以:輸入將是例如
RT @username I'm having one jolly good time!!
RT @username RT @username this is fun
I am not using RT as a label - I use my own "retweet" label :P
rt @name here rt is lowercase
輸出:
[RT] @username I'm having one jolly good time!!
[RT] @username RT @username this is fun
I am not using RT as a label - I use my own "retweet" label :P (no changes)
[RT] @name here rt is lowercase
這是對正則表達式或常規PHP工作呢?任何提示將不勝感激!