0

I have a string that can contain any number of any type of characters. I'm looking to use regex to extract patterns and put them into a String that I can later manipulate.

Ex: I want regex to extract all 3 digit sequences. So if I have a string that says "Easy as 123" I would get "123" from it.

BTW This is for C#.net and VB.net

Thanks a lot.

1 Answer 1

1

(\d+)

(       start capturing group
   \d   capture digits
+       capture one or more
)       end capturing group

That will extract digits. But I recommend you read up on regex so you can learn the conventions and write your own. Try using regexr to test them too.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks. Will do. Regex is not my strong point. I appreciate the help.
@PaulG You can browse the regex tag here on SO to get a feel for more complex regexs to aid your understanding. Good luck. (If the answer helped, make sure to hit the green check mark to accept it)
Thanks. I would accept the answer but I have to wait 8 minutes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.