How do I use preg_match to test for spaces?

前端 未结 7 1391
Happy的楠姐
Happy的楠姐 2020-12-28 13:47

How would I use the PHP function preg_match() to test a string to see if any spaces exist?

Example

"this sentence would be tested true for

7条回答
  •  梦谈多话
    2020-12-28 14:23

    Also see this StackOverflow question that addresses this.

    And, depending on if you want to detect tabs and other types of white space, you may want to look at the perl regular expression syntax for things such as \b \w and [:SPACE:]

提交回复
热议问题