Regular Expression to match 3 or more Consecutive Sequential Characters and Consecutive Identical Characters

前端 未结 15 2276
北荒
北荒 2020-11-28 11:41

I need regular expressions to match the below cases.

  1. 3 or more consecutive sequential characters/numbers; e.g. 123, abc, 789, pqr, etc.
  2. 3 or more cons
15条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-28 12:36

    for the second question:

    \\b([a-zA-Z0-9])\\1\\1+\\b
    

    explanation:

    \\b               : zero-length word boundary
      (               : start capture group 1
        [a-zA-Z0-9]   : a letter or a digit
      )               : end group
      \\1             : same character as group 1
      \\1+            : same character as group 1 one or more times
    \\b               : zero-length word boundary
    

提交回复
热议问题