/*
+ Regular Expression Engine for C language 1.2.0
+ REEC 1.2.0
+ (C)TOK WANG QUANWEI
+ Regular Engine is a free software created by (c) Techniques of Knowledge since 20090528,
+ you can redistribute it and/or modifyit under the terms of the gnu general public license
+ as published by the free software foundation, either version 3 of the license or any later
+ version.this program is distributed in the hope that it will be useful,but without any
+ warranty.without even the implied warranty of merchantability or fitness for a particular
+ purpose.
+
+ (c) Techniques of Knowledge
+ an open source group since 2008
+ page : http://www.tok.cc
+ email : wqw85@sina.com
+
*/
#include "rex.h"
int match_alpha_normal_limit_pattern( int alpha ) {
// author: WANG QUANWEI
// since : 20090528
// (C)TOK
int times = 0 ;
while ( 0 == _string_overflowed( object_string ) ) {
if (_smart_ == alpha) {
if (smart_alpha(_string_get(object_string)) && times != current_regular_expressions_atom -> pattern_times ) {
_string_add( &pattern_elements_matched , _string_get(object_string)) ;
_string_next( &object_string ) ;
current_regular_expressions_atom -> pattern_matched_times ++ ;
times ++ ;
} else if ( times == current_regular_expressions_atom -> pattern_times ) {
return 1 ;
} else if ( 0 < times ) {
if ( RS_LEVEL_1 == reecmonitor.rs_level )
return 0 ;
_string_next( &object_string ) ;
} else if ( !_string_overflowed( object_string ) ) {
if ( RS_LEVEL_1 == reecmonitor.rs_level )
return 0 ;
_string_next( &object_string ) ;
} else
return 0 ;
} else if (_strong_ == alpha) {
if (strong_alpha(_string_get(object_string)) && times != current_regular_expressions_atom -> pattern_times ) {
_string_add( &pattern_elements_matched , _string_get(object_string)) ;
_string_next( &object_string ) ;
current_regular_expressions_atom -> pattern_matched_times ++ ;
times ++ ;
} else if ( times == current_regular_expressions_atom -> pattern_times ) {
return 1 ;
} else if ( 0 < times ) {
if ( RS_LEVEL_1 == reecmonitor.rs_level )
return 0 ;
_string_next( &object_string ) ;
} else if ( !_string_overflowed( object_string ) ) {
if ( RS_LEVEL_1 == reecmonitor.rs_level )
return 0 ;
_string_next( &object_string ) ;
} else
return 0 ;
} else {
if ((smart_alpha(_string_get(object_string)) || strong_alpha(_string_get(object_string))) && times != current_regular_expressions_atom -> pattern_times ) {
_string_add( &pattern_elements_matched , _string_get(object_string)) ;
_string_next( &object_string ) ;
current_regular_expressions_atom -> pattern_matched_times ++ ;
times ++ ;
} else if ( times == current_regular_expressions_atom -> pattern_times ) {
return 1 ;
} else if ( 0 < times ) {
if ( RS_LEVEL_1 == reecmonitor.rs_level )
return 0 ;
_string_next( &object_string ) ;
} else if ( !_string_overflowed( object_string ) ) {
if ( RS_LEVEL_1 == reecmonitor.rs_level )
return 0 ;
_string_next( &object_string ) ;
} else
return 0 ;
}
}
return ( times == current_regular_expressions_atom -> pattern_times ) ? 1 : 0 ;
}
int match_alpha_none_limit_pattern ( int alpha ) {
// author: WANG QUANWEI
// since : 20090528
// (C)TOK
int times = 0 ;
while ( !_string_overflowed( object_string ) ) {
if (_smart_ == alpha) {
if (smart_alpha(_string_get(object_string))) {
_string_add( &pattern_elements_matched , _string_get(object_string)) ;
_string_next( &object_string ) ;
times ++ ;
} else if ( !_string_overflowed( object_string ) ) {
if ( 0 == times && RS_LEVEL_1 == reecmonitor.rs_level )
return 0 ;
else if ( 0 < times && RS_LEVEL_1 == reecmonitor.rs_level )
return 1 ;
_string_next( &object_string ) ;
} else if (times) {
return 1 ;
} else
return 0 ;
} else if (_strong_ == alpha) {
if (strong_alpha(_string_get(object_string))) {
_string_add( &pattern_elements_matched , _string_get(object_string)) ;
_string_next( &object_string ) ;
times ++ ;
} else if ( !_string_overflowed( object_string ) ) {
if ( 0 == times && RS_LEVEL_1 == reecmonitor.rs_level )
return 0 ;
else if ( 0 < times && RS_LEVEL_1 == reecmonitor.rs_level )
return 1 ;
_string_next( &object_string ) ;
} else if (times) {
return 1 ;
} else
return 0 ;
} else {
if (smart_alpha(_string_get(object_string)) || strong_alpha(_string_get(object_string))) {
_string_add( &pattern_elements_matched , _string_get(object_string)) ;
_string_next( &object_string ) ;
times ++ ;
} else if ( !_string_overflowed( object_string ) ) {
if ( 0 == times && RS_LEVEL_1 == reecmonitor.rs_level )
return 0 ;
else if ( 0 < times && RS_LEVEL_1 == reecmonitor.rs_level )
return 1 ;
_string_next( &object_string ) ;
} else if (times) {
return 1 ;
} else
return 0 ;
}
}
return times ? 1 : 0 ;
}
int match_alpha_scale_limit_pattern ( int alpha ) {
// author: WANG QUANWEI
// since : 20090528
// (C)TOK
int times = 0 ;
while ( !_string_overflowed( object_string ) ) {
if ( _smart_ == alpha ) {
if (smart_alpha(_string_get(object_string))) {
_string_add( &pattern_elements_matched , _string_get(object_string)) ;
_string_next( &object_string ) ;
times ++ ;
if (times == current_regular_expressions_atom -> pattern_max_times )
break ;
} else if ( !_string_overflowed( object_string ) ) {
if ( 0 == times && RS_LEVEL_1 == reecmonitor.rs_level )
return 0 ;
else if ( current_regular_expressions_atom -> pattern_times > times && RS_LEVEL_1 == reecmonitor.rs_level )
return 0 ;
else if ( current_regular_expressions_atom -> pattern_times <= times && RS_LEVEL_1 == reecmonitor.rs_level )
return 1 ;
_string_next( &object_string ) ;
} else if ( current_regular_expressions_atom -> pattern_times <= times && times <= current_regular_expressions_atom -> pattern_max_times ) {
return 1 ;
} else
return 0 ;
} else if ( _strong_ == alpha ) {
if (strong_alpha(_string_get(object_string))) {
_string_add( &pattern_elements_matched , _string_get(object_string)) ;
_string_next( &object_string ) ;
times ++ ;
if (times == current_regular_expressions_atom -> pattern_max_times )
break ;
} else if ( !_string_overflowed( object_string ) ) {
if ( 0 == times && RS_LEVEL_1 == reecmonitor.rs_level )
return 0 ;
else if ( current_regular_expressions_atom -> pattern_times > times && RS_LEVEL_1 == reecmonitor.rs_level )
return 0 ;
else if ( current_regular_expressions_atom -> pattern_times <= times && RS_LEVEL_1 == reecmonitor.rs_level )
return 1 ;
_string_next( &object_string ) ;
} else if ( current_regular_expressions_atom -> pattern_times <= times && times <= current_regular_expressions_atom -> pattern_max_times ) {
return 1 ;
} else
return 0 ;
} else {
if ( smart_alpha(_string_get(object_string)) || strong_alpha(_string_get(object_string)) ) {
_string_add( &pattern_elements_matched , _string_get(object_string)) ;
_string_next( &object_string ) ;
times ++ ;
if (times == current_regular_expressions_atom -> pattern_max_times )
break ;
} else if ( !_string_overflowed( object_string ) ) {
if ( 0 == times && RS_LEVEL_1 == reecmonitor.rs_level )
return 0 ;
else i
没有合适的资源?快使用搜索试试~ 我知道了~
OK_REEC正则表达式(C语言)
共10个文件
c:4个
h:3个
jpg:2个
5星 · 超过95%的资源 需积分: 15 60 下载量 155 浏览量
2013-04-04
23:36:56
上传
评论 3
收藏 78KB RAR 举报
温馨提示
REEC是一个精简,高效的C语言正则表达式引擎,它使得C语言开发中支持正则表达式,目前已经进化到了1.2.0版本,可以说无论从功能上,还是效率都到达了很好的应用水平,该引擎除支持常用的正则标准之外,还有一些原创的特性,例如正则式的分组、模式敏感等级等等,使得正则表达式更加灵活多变。
资源推荐
资源详情
资源评论
收起资源包目录
TOK_REEC正则表达式.rar (10个子文件)
(C)TOK REEC V1.2.0
reec.xls 161KB
rex.h 8KB
main.c 20KB
reec.c 76KB
T0K.jpg 3KB
reio.h 839B
rex.c 9KB
reec.jpg 21KB
reec.h 2KB
reio.c 1KB
共 10 条
- 1
资源评论
- 圣诞节诶2016-11-22下载下来学习的,好好学习一下正则表达式
- launch_1232016-07-09下载来参考一下
- jiemnij2014-01-16这个要支持的,,不过目前还不会用,, 不过有源码, 有时间慢慢看.
- CoMfOrT_LiFe2015-03-12非常好,可以用的上
半棵树
- 粉丝: 2537
- 资源: 247
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功