Regex that return only numbers

Hello,

Do you know the answer for the following question:

if i have the following text " My birthday is on 20-April and my Personal identification number is 21931231923123"

Is there any options to return “20-April” and “21931231923123” using regex ?

Thank you !

Hi @Dragos_Padurariu

Use the below regex for

Date of Birth : \d{2}-\w+

Personal Identification number : \d{5,}

You can test the above regex in regex101.com

Import system.text.regularexpressions

use an assign statement,

Regex.match(inputstring,“Pattern”)

Input string - My birthday is on 20-April and my Personal identification number is 21931231923123

Pattern for Birthday : \d{2}-\w+

3 Likes

Hi @Dragos_Padurariu,

You can use these patterns also.

(?<=Personal identification number is )\d{5,}

(?<=birthday is on )\d{2}-\w+

Thank you for your help and for your prompt reply !

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.