how to use preg_match to check whole text

前端 未结 2 1070
执笔经年
执笔经年 2021-01-17 03:12

Hi i have a problem with preg_match function.
i want to check whole text against pattern and return true if whole text matched with pattern and false for not matched or

2条回答
  •  青春惊慌失措
    2021-01-17 03:54

    Just change the pattern like this:

    "/^[\d]+$/"
    

    Remember that:

    • ^: means the start of the string
    • $: means the end of the string

提交回复
热议问题