Hi I have an URL like “/yyyyyy/xm”, where x can be an integer denoting the number of minutes. I need to parse and get this value. Any idea of how this can be using regex or String.split() method? The pattern of the URL is always the same like for example:
/magnetic/20m should give me the value 20
/temperature/500m should give me the value 500
Thanks in advance!
The following should work:
You just need to access to the 1st group of the match, and you’ll get the numbers there.
Edit:
In the future, finding the regex by yourself. That’s a pretty straightforward regex question.