开发者

Only filter out the alphanumeric text

How can I only take the alphanumeric text and spaces from a given text.

I can do the regex and I have come up with -> [A-Za-z0-9 ]+ but I dont know any functions in php which will take the text and apply th开发者_StackOverflow中文版at rule and return me the match.


You can use the preg_grep function. See the PHP documentation for details.


mixed preg_replace ( mixed $pattern , mixed $replacement , mixed $subject [, int $limit = -1 [, int &$count ]] )

(source: http://www.php.net/manual/en/function.preg-replace.php)

What about doing a little bit of research before asking questions?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜