Regular expressions: Special characters of "-" (minus sign)

Disclaimer: This article is a blogger original article, please indicate the source. https://blog.csdn.net/qq_42968609/article/details/88366975

Minus character set used in the "[...]" represents a set of characters in, such as:

   “[1-3]” —— 表示1到5中的任意一个字符,所以“<H[1-3]>”表示“<H1>”、“<H2>”或者“<H3>”
   “[d-g]” —— 表示“d”、“e”、“f”或者“g”

If it is not used in the character set. "[...]", the character is an ordinary, ie minus:

    “1-[1-3]” —— 表示“1-1”、“1-2”或者“1-3”

However, even in the character set. "[...]", the Quefei between successive characters, loses its special meaning:

    “1[-1]” —— 表示“1-”或者“11”

Guess you like

Origin blog.csdn.net/qq_42968609/article/details/88366975