Java (Regex?) split string between number/letter combination

前端 未结 5 1953
甜味超标
甜味超标 2021-01-05 08:44

I\'ve been looking through pages and pages of Google results but haven\'t come across anything that could help me.

What I\'m trying to do is split a string like

5条回答
  •  迷失自我
    2021-01-05 09:26

    You need to Replace and then split the string.You can't do it with the split alone

    1> Replace All the string with the following regex

    (\\w+?)(\\d+)
    

    and replace it with

    $1:$2
    

    2> Now Split it with this regex

    (?<=\\d)(?=[a-zA-Z])
    

提交回复
热议问题