a Twitter url.
The format is twitter.com/{username}/{status-id}.
Now I have something like this:
https://twitter.com/user9ame/status/109920294020202031
I'm trying to extract only the status id which I numbers.
I tried using regex to strip of the strings and chars.
It worked,
but in a case where their is an integer in the handle then the integer joins the status id.
Is there a better way i can do this?
stringObject.split("/")
$ echo https://twitter.com/user9ame/status/109920294020202031 | sed 's/.*\/\([0-9]\)/1/' 109920294020202031 this works but I've struggled enough with the Pattern class to even act like an expert on how it's gonna work with this. Alternatively you can just split on "/", then get the element at length - 1
Обсуждают сегодня