regular expression to match an empty (or all whitespace) string

前端 未结 7 1162
孤城傲影
孤城傲影 2021-01-12 10:04

i want to match a string that can have any type of whitespace chars (specifically I am using PHP). or any way to tell if a string is empty or just has whitespace will also h

7条回答
  •  悲哀的现实
    2021-01-12 10:39

    You don't need regular expressions for that, just use:

    if ( Trim ( $str ) === '' ) echo 'empty string';
    

提交回复
热议问题