How do I use a regular expression to match any string, but at least 3 characters?

前端 未结 6 1330
陌清茗
陌清茗 2020-12-29 01:49

I am not a regex expert, but my request is simple: I need to match any string that has at least 3 or more characters that are matching.

So for instance, we have the

6条回答
  •  失恋的感觉
    2020-12-29 02:18

    If you want to match starting from the beginning of the word, use:

    \b\w{3,}
    

    \b: word boundary

    \w: word character

    {3,}: three or more times for the word character

提交回复
热议问题