M
M
mxbk412021-03-12 14:20:00
Java
mxbk41, 2021-03-12 14:20:00

What to make a regular expression that will pull out the IDs of certain users?

I have an array, let's say:

{"Ivanov", "id":7},
{"Sidorov", "id":4},
{"Petrov", "id":3},
{"Petrov", "id":2},
{"Kozlov", "id":9};


It is necessary to pull out only Petrov's ID, without a surname.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
N, 2021-03-12
@mxbk41

I don't know the JAVA syntax... but here's an example regexp:
\{\"Petrov\", \"id\":(\d+)\}
Clearly:
https://regex101.com/r/t6DaXA/1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question