Split string in alphabet and number

前端 未结 1 1914
清歌不尽
清歌不尽 2021-01-22 07:32

Would anyone be able to assist me with some regex. I want to split the following string into alphabet and number.

Example String ns01sp0001 after split it

1条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-22 07:55

    You can use:

    String tok[] = str.split("(?<=\\D)(?=\\d+\\b)");
    

    RegEx Demo

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