E
E
egorzenit2019-08-11 19:25:56
Parsing
egorzenit, 2019-08-11 19:25:56

How to clean a string from extra characters?

Greetings,
For example, there is a link line:
https://vk.com/wall-307584833_1982089?reply=3438479
How can I extract the numbers from this link that come after wall,
that is, 307584833
and after reply= (3438479)
And place them in long variables?
Never encountered parsing :(
I hope for your help, thanks!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Developer, 2019-08-11
@egorzenit

Match match = Regex.Match("https://vk.com/wall-307584833_1982089?reply=3438479", @"wall\-(\d+)_\d+\?reply\=(\d+)",
            RegexOptions.IgnoreCase);
        if (match.Success)
        {
            string wallId= match.Groups[1].Value;
             string replyId= match.Groups[2].Value;
        }

S
sim3x, 2019-08-11
@sim3x

https://stackoverflow.com/questions/15713542/elega...

Uri myUri = new Uri("https://vk.com/wall-307584833_1982089?reply=3438479");

long reply_id = (long)HttpUtility.ParseQueryString(myUri.Query).Get("reply");

In addition to the fact that you have never encountered parsing, you have also never encountered Sharp and, moreover, Google

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question