[Solved] ASP.Net Regular Expression Error: Character range is out of order

on Mar 23, 2021 07:14 AM


I am new to regular expressions and have been given the following regular expression:

var reg = new Regex(@"^[\s\p{L}•-]");
  1. I know that \p{L} matches a single code point in the category "letter".
  2. I know that \s metacharacter is used to find a whitespace character.
  3. I know that this regexp is to check if a line starts with a whitespace, a letter, the bullet character or the - character.

But if I need to check also if a line starts with a number this is the solution?

var reg =newRegex(@"^[\s\p{L}•-[1-9][0-9]?$|^100$]");

On https://regex101.com/r/j8oH20/1 I have pattern error.

All the errors detected are listed below, from left to right, as they appear in the pattern.
- Character range is out of order

Can someone help me?

Any help would greatly appreciate.

Thank you.

Download FREE API for Word, Excel and PDF in ASP.Net: Download
on Mar 23, 2021 07:20 AM

Check with the regular expressions