search

Home  >  Q&A  >  body text

java - 如何用正则表达式

(?:(?:[0-9]\\d{2}))这个表达式是什么意思

巴扎黑巴扎黑2802 days ago660

reply all(2)I'll reply

  • 大家讲道理

    大家讲道理2017-04-18 10:52:24

    This brings up the concept of grouping.

    The parentheses () in the regular expression will produce grouping. The grouping can use placeholders to represent the matching value in the expression. The grouping starts from 1.

    For example: (d+)-1 中的第一个小括号匹配的是 1 个以上的数字,那么分组1表示为 1,整个表达式可以匹配 123-123 This format separates the numbers before and after with a dash.

    And if you add ?: 即表示不产生分组号,此时 (?:d+)-1 匹配的就只是 123-1 in brackets.

    Although (?:(?:[0-9]d{2})) looks complicated, it actually just matches 3 numbers.

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-18 10:52:24

    This should be a 3-digit number from 0 to 9.

    reply
    0
  • Cancelreply