Skip to content

Instantly share code, notes, and snippets.

@dnnta
Created June 28, 2012 03:44
Show Gist options
  • Save dnnta/3008842 to your computer and use it in GitHub Desktop.
Save dnnta/3008842 to your computer and use it in GitHub Desktop.
web regex
//
// Config.h
// ZanSe
//
// Created by dnnta on 12-12-13.
// Copyright (c) 2012年 NightWish. All rights reserved.
//
//
// Config.h
// Zhihu
//
// Created by Kevin Nick on 2012-10-28.
// Copyright (c) 2012年 com.zen. All rights reserved.
//
#ifndef SysLog
#if DEBUG
#define SysLog(fmt, ...) NSLog((@"%s [Line: %d] \n " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#define SysLog(fmt, ...)
#define NSLog(fmt, ...)
#endif
#endif
#define RGB(r, g, b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]
#define RGBA(r, g, b, a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]
#define DarkColor [UIColor darkGrayColor]
// Helvetica Hiragino
// Post Content Font
#define PCFont [UIFont fontWithName:@"Helvetica" size:15]
// Post Author Font
#define PAFont [UIFont fontWithName:@"Helvetica" size:13]
// ******************************************
// String Define
#define ZANSE_BASE_URL @"http://bbs.jjwxc.net"
#define POST_REGEX \
@"href=\"showmsg.php\\?board=(\\d+)&id=(\\d+)&msg=.*\" target=\"_blank\" title=\"最后更新:(.*?)\">(.*?)&nbsp;[\\s\\S]*?<td>&nbsp;(.*?)</td>[\\s\\S]*?size=\"-1\">(.*?)</font>[\\s\\S]*?size=-1>(\\d+)&nbsp;</font>[\\s\\S]*?size=-1>(\\d+)&nbsp;"
#define POST_INFO \
@"主题:(.*?)\\s<font color=\"#999999\" size=\"-1\">\\[(\\d+),(\\d+)\\]"
#define DETAIL_REGEX \
@"<td class=\"read\">([\\s\\S]*?)</td>[\\s\\S]*?№(\\d+).*?</font>.*?</font>(.*?)</b>.*?</font>(.*?)留言"
#define Post_Path(board, page) \
[NSString stringWithFormat:@"board.php?board=%d&page=%d", board, page];
#define Comment_Path(board, pid, page) \
[NSString stringWithFormat:@"showmsg.php?board=%@&id=%@&page=%d", board, pid, page]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment