I have a string like :
String time = "2 hrs 5 minutes 2 seconds" ;
or
String time2 = "2 hrs 1 minute 1 second" ;
I have to find number space second(s)
and need to remove using regex?
is that possible..
I have tried using [1-9a-z ]
- but its wrong. could anyone help?
CodePudding user response:
Please use
\d \sseconds?
Regex explanation
\d
Any number\s
A space characterseconds?
Matchsecond
orseconds