O
O
onlinejunior2020-05-13 22:47:29
go
onlinejunior, 2020-05-13 22:47:29

How to pick up a number?

Links look like this:

https://site.com/@name/jpg/12345678910111212
https://site.com/@name/12345678910111212/jpg
https://site.com/@124341/12345678910111212/jpg
https://site.com/@12sccss4341/12345678910111212/jpg


You need to get it:

12345678910111212

my code only gets it from:

str := "https://site.com/@name/jpg/12345678910111212"

re := regexp.MustCompile(`(?m)(\d+)$`)

fmt.Println(re.FindString(str))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Shvedov, 2020-05-13
@onlinejunior

https://regex101.com/r/ucuqP3/1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question