Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
my $string3 = "anima ls"; my $t3 = $string3 =~ /[^\s]+/; print "$t3\n";
我想编写一个搜索不包含空格的字符串的正则表达式。即使我给空间,上面的代码也有效。
正则表达式[^\s]+搜索至少一个不是空格的字符。不过最好写成\S+. 匹配任何不包含空格字符的字符串的正则表达式是
[^\s]+
\S+
/^\S+$/