开发者

php grep exec or system regex

How can I grep a pattern that can include spaces, commas etc using exec or system in PHP, and return one string separated by a comma each result. If needed, I can make use of awk or sed to separated by comma.

So for instance, if the pattern to se开发者_运维知识库arch is: hello worl then return:

$result = 'hello world, hello worlds, hello worldy';

Any ideas will be appreciated. Thanks


Check out escapeshellarg() and escapeshellcmd().

Edit:

Is this in just one file? If you're not searching across the system then just use the built-in functions, they'll be plenty fast.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜