惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
博客园_首页
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
量子位
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
人人都是产品经理
人人都是产品经理
T
Troy Hunt's Blog
H
Hacker News: Front Page
N
News and Events Feed by Topic
N
News | PayPal Newsroom
www.infosecurity-magazine.com
www.infosecurity-magazine.com
PCI Perspectives
PCI Perspectives
有赞技术团队
有赞技术团队
Google Online Security Blog
Google Online Security Blog
博客园 - 【当耐特】
Schneier on Security
Schneier on Security
S
SegmentFault 最新的问题
博客园 - Franky
T
The Blog of Author Tim Ferriss
罗磊的独立博客
T
The Exploit Database - CXSecurity.com
I
Intezer
Microsoft Security Blog
Microsoft Security Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
B
Blog
L
Lohrmann on Cybersecurity
T
Threat Research - Cisco Blogs
U
Unit 42
Forbes - Security
Forbes - Security
MyScale Blog
MyScale Blog
J
Java Code Geeks
S
Secure Thoughts
G
Google Developers Blog
SecWiki News
SecWiki News
T
Tailwind CSS Blog
T
Tor Project blog
P
Proofpoint News Feed
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Hacker News: Ask HN
Hacker News: Ask HN
P
Privacy International News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
雷峰网
雷峰网
美团技术团队
T
Threatpost
小众软件
小众软件
W
WeLiveSecurity

博客园 - 嚣张的沉默

读写txt文档 限制TextBox输入字数 计算TextBox输入的字数 DataSet导入到Excel 年月日联动的JS代码 用户控件的传值方法 Repeater模板列 asp.net的几个小技巧 百叶窗效果 建站安全 倒计时代码 解决SQL2000安装服务器挂起 删除.NET的最近项目 屏幕右下角弹出广告 DataSet写入、导出XML 上传图片重命名并创建文件夹 自动跳转页面带参数 微软出的AJAX控件的安装(转载) 第一次开博
我常用的正则与SQL语句
嚣张的沉默 · 2008-01-25 · via 博客园 - 嚣张的沉默

//判断是否为字母与数字
^[A-Za-z0-9]+$

//判断移动电话或固定电话(我是大连的,所以区号是0411)
^(?:1[35]\d{9}|0411\d{8})$

//判断年龄
^(1[0-2]\d|\d{1,2})$

//字母数字汉字
^[a-zA-Z0-9\u4e00-\u9fa5]+$

//判断是文件类型

^.+\.(jpe?g|JP?G|Jp?g|GIF|Gif|gif)$

===================================================================

还有一些SQL语句
//查询本周情况
select * from cardInfo
where
datepart(wk,字段名)=datepart(wk,getdate())
and
datepart(yy,字段名)=datepart(yy,getdate())

//随机抽取4个
select top 4 * from tablename order by newid()

//不全显示电话号码
select left(ltrim(字段名),3)+'****'+right(rtrim(字段名),4) from 表名
Select Stuff(字段名, 4, 4, '****') As num From 表名

//数据为1或0,显示出来为是或否
select (case 字段名 when 1 then '是' else '否' end) as isTrade from client

//把字段中的回车替换成空格

select audName,audSex,audAge,audTel,replace(audcontent,char(13)+char(10),''),audEpname as 游戏名称,audTime from audited

//循环插入数据

declare @a bigint
set @a=2008080841100001
while @a<=2008080841199999
begin
insert into card(cardNum)
select @a
set @a=@a+1
end


declare @k bigint
declare @n bigint
set @k=2008080841100001
select @n=max(cardnum) from card
while(@k<2008080841199999)
begin
INSERT INTO [card]
           ([cardnum])
     VALUES
           (@k)
set @k=@k+1
end

循环更新某字段

declare @t table(aaa int,  eee int,  ccc varchar(2),  ddd  int)
insert @t select
1 ,   2    ,'a',    100  union select
2 ,   2    ,'a',    null union select
3 ,   1    ,'c',    null union select
4 ,   2    ,'a',    null union select
5 ,   3    ,'a',    null union select
6 ,   2    ,'b',    null union select
7 ,   2    ,'a',    null union select
8  ,  2    ,'a',    null union select
9  ,  2    ,'a',    null 


declare @i int
set @I = -1

update @t 
set ddd = @i,@i =isnull(ddd,0+ @i +1
where eee = 2 and ccc = 'a'
select * from @t