用C普通防爆pressions [英] Regular Expressions in C

查看:90
本文介绍了用C普通防爆pressions的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很好奇,没有任何人知道一个很好的方法做定期的前pression匹配用C?我能想到的唯一方法是通过的Flex。这是唯一的办法还是有更好的办法?

I'm curious, does anybody know a good way to do regular expression matching in C? The only way I can think of is through Flex. Is this the only way or is there a better way?

谢谢!

推荐答案

呃......最好的办法就是

Uh ... The best way is to

#include <regex.h>

这是POSIX 定期EX pressions标准API

对于非POSIX系统,滚动你自己是一个选择,一个基本的正则表达式引擎是不是太难完成的任务。我敢肯定,有现成的现成解决方案太多,我没有neded之一。

For non-POSIX systems, rolling your own is one alternative, a basic regex engine is not too hard to accomplish. I'm sure there are off-the-shelf solutions too, I haven't neded one.

试想想起来了,我想的油嘴滑舌有一个。

Come to think of it, I think glib has one.

这篇关于用C普通防爆pressions的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆