简体   繁体   中英

Splitting a string on two zero-width assertions

I would like to isolate a number within a string by splitting it on two zero-width assertions. I can split on the first

strsplit("nursereviewday36_arm_1", "(?<=[[:alpha:]])(?=[[:digit:]])", perl = T)

So that it returns

[[1]]
[1] "nursereviewday" "36_arm_1"  

But I would like to split into three like so

[[1]]
[1] "nursereviewday" "36" "_arm_1" 

This is in R but any regex that solves this will do

尝试这个:

 (?<=[[:alpha:]])(?=[[:digit:]])|(?<=[[:digit:]])(?=_)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM