regex to remove ordinals

后端 未结 5 1190
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-30 14:36

I need to remove ordinals via regex, but my regex skills are quite lacking. The following locates the ordinals, but includes the digit just prior in the return value. I need

5条回答
  •  抹茶落季
    2020-11-30 14:37

    Try a negative lookbehind:

    (?<=[0-9])(?:st|nd|rd|th)
    

    assuming the dialect of regex supports it.

提交回复
热议问题