Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I make the following RegEx pattern?

I need a regex pattern.

XXX[NUMBER]

For Example:
XXX[123456]

or

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

[NUMBER]XXX

For Example:
[123456]XXX

What is the pattern to match these two pattern ?

I tried the following way, but I can only add the parentheses to the beginning of the numbers:

[\[0-9]{0,35}[X]{0,35}|[X]{0,35}[\[0-9]{0,35}

Kind regards.

>Solution :

If you want just the numbers with the parenthesis:

var regex = new Regex(@"\[\d+\]");
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading