<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>#raynix# &#187; regex</title>
	<atom:link href="http://raynix.info/archives/tag/regex/feed" rel="self" type="application/rss+xml" />
	<link>http://raynix.info</link>
	<description>The real world hurts, doesn't it? </description>
	<lastBuildDate>Thu, 09 Sep 2010 04:40:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>带着小抄去上班</title>
		<link>http://raynix.info/archives/458</link>
		<comments>http://raynix.info/archives/458#comments</comments>
		<pubDate>Mon, 09 Mar 2009 07:34:30 +0000</pubDate>
		<dc:creator>raynix</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[regex]]></category>

		<guid isPermaLink="false">http://raynix.cn/?p=458</guid>
		<description><![CDATA[你上考场那年带小抄了么？带了也别说，那是作弊。不过上班跟考试不同，你要尽可能的用上一切能方便工作的工具。下面是我最近喜欢的几张小抄： 以上小抄来自 http://www.addedbytes.com/cheat-sheets Thanks Dave! © raynix for #raynix#, 2009. &#124; Permalink &#124; 唉, 一个评论都没 &#124; Add to del.icio.us Post tags: css, Python, regex Feed enhanced by Better Feed from Ozh]]></description>
			<content:encoded><![CDATA[<p>你上考场那年带小抄了么？带了也别说，那是作弊。不过上班跟考试不同，你要尽可能的用上一切能方便工作的工具。下面是我最近喜欢的几张小抄：</p>

<a href='http://raynix.info/archives/458/css-cheat-sheet-v2' title='css-cheat-sheet-v2'><img width="150" height="150" src="http://raynix.info/wp-content/uploads/2009/03/css-cheat-sheet-v2-150x150.png" class="attachment-thumbnail" alt="css-cheat-sheet-v2" title="css-cheat-sheet-v2" /></a>
<a href='http://raynix.info/archives/458/python-cheat-sheet-v1' title='python-cheat-sheet-v1'><img width="150" height="150" src="http://raynix.info/wp-content/uploads/2009/03/python-cheat-sheet-v1-150x150.png" class="attachment-thumbnail" alt="python-cheat-sheet-v1" title="python-cheat-sheet-v1" /></a>
<a href='http://raynix.info/archives/458/regular-expressions-cheat-sheet-v2' title='regular-expressions-cheat-sheet-v2'><img width="150" height="150" src="http://raynix.info/wp-content/uploads/2009/03/regular-expressions-cheat-sheet-v2-150x150.png" class="attachment-thumbnail" alt="regular-expressions-cheat-sheet-v2" title="regular-expressions-cheat-sheet-v2" /></a>

<p>以上小抄来自<a href="http://www.addedbytes.com/cheat-sheets" target="_blank"> http://www.addedbytes.com/cheat-sheets</a> Thanks Dave!</p>
<hr />
<p><small>© raynix for <a href="http://raynix.info">#raynix#</a>, 2009. |
<a href="http://raynix.info/archives/458">Permalink</a> |
<a href="http://raynix.info/archives/458#comments">唉, 一个评论都没</a> |
Add to
<a href="http://del.icio.us/post?url=http://raynix.info/archives/458&title=带着小抄去上班">del.icio.us</a>
<br/>
Post tags: <a href="http://raynix.info/archives/tag/css" rel="tag">css</a>, <a href="http://raynix.info/archives/tag/python" rel="tag">Python</a>, <a href="http://raynix.info/archives/tag/regex" rel="tag">regex</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://raynix.info/archives/458/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>牛刀小试RegEx</title>
		<link>http://raynix.info/archives/64</link>
		<comments>http://raynix.info/archives/64#comments</comments>
		<pubDate>Fri, 27 Apr 2007 05:45:28 +0000</pubDate>
		<dc:creator>raynix</dc:creator>
				<category><![CDATA[Opensource]]></category>
		<category><![CDATA[Ruby & Rails]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://raynix.bjqnc.com/archives/64</guid>
		<description><![CDATA[RegEx中文叫做正则表达式，虽然不是很新的东西了，我很纳闷我居然是才开始了解它。在数据库中查询keyword一般是写成 select * from tablename where columnname LIKE '%keyword%' 而java我记得不是很清楚了，大概是 if(myString.indexOf(keyword) != -1){ //do things... } 这个只是简单匹配，如果有复杂要求就要写多得多的代码了。例如判断keyword是否是一个数字开头，紧跟1个小写字母，跟随若干数字，最后以"pattern"结尾等等，就不是一行代码能写出来的了。对于上例，RegEx+Ruby的写法就是 if keyword =~ /^\d[a-z]\d+pattern$/ #do things end 上式中，//是RegEx的边界，类似""是字符串的边界一样。接下来^代表匹配的开始；\d代表数字，就是0 - 9；[a-z]就是一个从a到z的小写字母了；+是后缀，表示1个或多个，因此\d+就是1个或多个数字的意思了；最后作为关键字的pattern直接写上即可；$代表匹配的结束。 更灵活的应用就是&#124;符号和()括号了。例如判断文本是否包含x或X，RegEx就可以写 /x&#124;X/ 如果要判断文本是否包含多个连续的x或者X，例如xXX、XxX，RegEx就可以写 /(x&#124;X)+/ 如果要判断文本是否包含XXX、XXXX、XXXXX，RegEx可以写 /X{3,5} / 目前的了解就是这么多了，不过以上这些组合起来应该已经可以应付很多种情况了。继续学习。 © raynix for #raynix#, 2007. &#124; Permalink &#124; 唉, 一个评论都没 &#124; Add to del.icio.us Post tags: regex, ruby on rails [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://raynix.bjqnc.com/wp-content/uploads/2007/04/img_regex_big.gif" alt="img_regex_big.gif" /></p>
<p>RegEx中文叫做正则表达式，虽然不是很新的东西了，我很纳闷我居然是才开始了解它。在数据库中查询keyword一般是写成</p>
<p>select * from tablename where columnname LIKE '%keyword%'</p>
<p>而java我记得不是很清楚了，大概是</p>
<p>if(myString.indexOf(keyword) !=  -1){<br />
//do things...<br />
}</p>
<p>这个只是简单匹配，如果有复杂要求就要写多得多的代码了。例如判断keyword是否是一个数字开头，紧跟1个小写字母，跟随若干数字，最后以"pattern"结尾等等，就不是一行代码能写出来的了。对于上例，RegEx+Ruby的写法就是</p>
<p>if keyword =~ /^\d[a-z]\d+pattern$/<br />
#do things<br />
end</p>
<p>上式中，//是RegEx的边界，类似""是字符串的边界一样。接下来^代表匹配的开始；\d代表数字，就是0 - 9；[a-z]就是一个从a到z的小写字母了；+是后缀，表示1个或多个，因此\d+就是1个或多个数字的意思了；最后作为关键字的pattern直接写上即可；$代表匹配的结束。</p>
<p>更灵活的应用就是|符号和()括号了。例如判断文本是否包含x或X，RegEx就可以写</p>
<p>/x|X/</p>
<p>如果要判断文本是否包含多个连续的x或者X，例如xXX、XxX，RegEx就可以写</p>
<p>/(x|X)+/</p>
<p>如果要判断文本是否包含XXX、XXXX、XXXXX，RegEx可以写</p>
<p>/X{3,5} /</p>
<p>目前的了解就是这么多了，不过以上这些组合起来应该已经可以应付很多种情况了。继续学习。</p>
<hr />
<p><small>© raynix for <a href="http://raynix.info">#raynix#</a>, 2007. |
<a href="http://raynix.info/archives/64">Permalink</a> |
<a href="http://raynix.info/archives/64#comments">唉, 一个评论都没</a> |
Add to
<a href="http://del.icio.us/post?url=http://raynix.info/archives/64&title=牛刀小试RegEx">del.icio.us</a>
<br/>
Post tags: <a href="http://raynix.info/archives/tag/regex" rel="tag">regex</a>, <a href="http://raynix.info/archives/tag/ruby-on-rails" rel="tag">ruby on rails</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://raynix.info/archives/64/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
