Using rubular http://rubular.com/ I'm trying to parse the hours minutes and seconds from a format 4H40M20S
So far I have this
(\d*)H(\d*)M(\d*)S
Which works fine for 4H40M20S
but not for 40M20S
What do I need to change to get it to work in this case?
Looks like you're after something like:
([\d]+[HMS])+
If you want to capture each section seperately, then use:
([\d]+H)?([\d]+M)?([\d]+S)
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.