Regex to convert kbt-y102_9999_0001v-s001v => N1v-s1v

后端 未结 1 464
囚心锁ツ
囚心锁ツ 2021-01-25 13:23

I\'m looking for a Regex that converts a string like

kbt-y102_9999_0001v-s001v

into N1v-s1v

kbt-y102_          


        
相关标签:
1条回答
  • 2021-01-25 13:54

    You could capture 1v and 1r in a group and replace with:

    N$1-S$2

    [^_]+_[0-9]{4}_[0-9]{3}([0-9][vr])-s0+([0-9][vr])

    Demo

    0 讨论(0)
提交回复
热议问题