<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[Heck's  Blog]]></title> 
<link>https://www.heckjj.com/index.php</link> 
<description><![CDATA[一瞬间的决定，往往可以改变很多，事实上，让自己成功的往往不是知识，是精神！ 如果你总是为自己找借口，那只好让成功推迟。执行力，今天！]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[Heck's  Blog]]></copyright>
<item>
<link>https://www.heckjj.com/regex-to-achieve-can-only-eng-and-num/</link>
<title><![CDATA[c# winform中用正则实现只能输入英文和数字]]></title> 
<author>Heck &lt;@hecks.tk&gt;</author>
<category><![CDATA[编程杂谈]]></category>
<pubDate>Sun, 24 Oct 2010 00:36:11 +0000</pubDate> 
<guid>https://www.heckjj.com/regex-to-achieve-can-only-eng-and-num/</guid> 
<description>
<![CDATA[ 
	<span style="font-family: 微软雅黑;">首先要引入using System.Text.RegularExpressions;<br/>string pattern = @&quot;^[a-zA-Z0-9]+$&quot;;//正则式子<br/>string param1 = null;<br/>Match m = Regex.Match(this.textBox1.Text, pattern);&nbsp;&nbsp; // 匹配正则表达式，把this.textBox1.Text跟pattern正则对比<br/><br/>if (!m.Success)&nbsp;&nbsp; // 判断输入的是不是英文和数字，不是进入<br/>&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;param1 = this.textBox1.Text;//将现在textBox的值保存下来<br/>&nbsp;&nbsp;&nbsp;&nbsp;// 将光标定位到文本框的最后<br/>&nbsp;&nbsp;&nbsp;&nbsp;this.textBox1.SelectionStart = this.textBox1.Text.Length;<br/>&#125;</span><span style="font-family: 微软雅黑;"><br/>else&nbsp;&nbsp; //输入的是英文和数字<br/>&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;param1 = this.textBox1.Text;&nbsp;&nbsp; // 将现在textBox的值保存下来<br/>&#125;</span><br/>Tags - <a href="https://www.heckjj.com/tags/%25E6%25AD%25A3%25E5%2588%2599/" rel="tag">正则</a> , <a href="https://www.heckjj.com/tags/%25E8%258B%25B1%25E6%2596%2587/" rel="tag">英文</a> , <a href="https://www.heckjj.com/tags/%25E6%2595%25B0%25E5%25AD%2597/" rel="tag">数字</a>
]]>
</description>
</item><item>
<link>https://www.heckjj.com/regex-to-achieve-can-only-eng-and-num/#blogcomment</link>
<title><![CDATA[[评论] c# winform中用正则实现只能输入英文和数字]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://www.heckjj.com/regex-to-achieve-can-only-eng-and-num/#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>