参考资料:
http://hi.baidu.com/answer512/blog/item/6b6e921b81b2e2d7ad6e75dd.html
J2EE用户注册需要实现E-mail验证,研究了下Java正则表达式。
参考资料:
http://hi.baidu.com/tian%5F20032242/blog/item/662441fa1b297e14a8d311db.html
http://www.cnblogs.com/gardenforu/archive/2009/09/24/1573457.html
http://cnsicau.blog.163.com/blog/static/2088949320072128438112/
自己根据163和新浪邮箱注册规则写的E-mail验证Java正则表达式(没做过全面测试哦~):
[0-9a-zA-Z][0-9a-zA-Z_]*[^_]@[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*\\.[0-9a-zA-Z]+$
#ifndef _HEAP_H_
#define _HEAP_H_
class Heap {
private:
int syn[100];//存储词法分析后的符号表
int head, tail;//游标
public:
Heap();
~Heap();
int first();//head=0并返回该syn。-1表示失败。
int prev();//head前移并返回该syn。-1表示失败。
int next();//head后移并返回该syn。-1表示失败。
bool append(int);//加入syn
};
#endif
#include “StdAfx.h”
#include “Heap.h”
Heap::Heap()
{
for(int i = 0; i < 100; i++)
syn[i] = -1;
head = tail = 0;
}
Heap::~Heap()
{
}
int Heap::first()
{
head = 0;
return syn[head];
}
int Heap::prev()
{
if(head == 0)
return -1;
return syn[–head];
}
int Heap::next()
{
if(head == tail – 1)
return -1;
return syn[++head];
}
bool Heap::append(int tempsyn)
{
if(tail >= 200)
return false;
syn[tail++] = tempsyn;
return true;
}