在C中注册? [英] ereg in C?

查看:132
本文介绍了在C中注册?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

这是我试图在C中实现的php代码:

Hi guys

Here is a php code what I trying to implement in C:

$row = "abcdef 1.2.3.4:65535 ewqe wqe2 e12312 233.1.33 3312 dsad qwq 9. .2.3 6.7.8.9";
$ipp = '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}(/[0-9]{1,2}){0,1}\:[0-9]{1,5}';
ereg ($ipp, $row, $matches);
$rowx=$matches[0];
print_r($matches);
print $rowx;
// The only match will be 1.2.3.4:65535



该代码的作用是从垃圾数据中仅提取特定的正则表达式,而这可能是任意的.在此示例中,我从数据流中提取ip:port信息.

我需要在Linux的C语言中完成此操作(匹配还不够).



What this code does is extracts only specific regexp from junk data which can be whatever. In this example I extract ip:port informations from data streams.

I need this to be done in C for linux (matching is not enough).

推荐答案

row = " abcdef 1.2.3.4:65535 ewqe wqe2 e12312 233.1.33 3312 dsad qwq 9. .2.3 6.7.8.9"
row = "abcdef 1.2.3.4:65535 ewqe wqe2 e12312 233.1.33 3312 dsad qwq 9. .2.3 6.7.8.9";


ipp = '
ipp = '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}(/[0-9]{1,2}){0,1}\:[0-9]{1,5}'; ereg (


ipp,


这篇关于在C中注册?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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