<?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>{Memo8&#124;Tool Kits} For Web Developer &#187; Regular Expressions</title>
	<atom:link href="http://www.memo8.com/toolkits/archives/tag/regular-expressions/feed" rel="self" type="application/rss+xml" />
	<link>http://www.memo8.com/toolkits</link>
	<description>ไว้เก็บ Script ไอเดีย ทิป เทคนิคต่างๆ สำหรับงานพัฒนาเว็บไซต์ทั้ง Design และ Programming</description>
	<lastBuildDate>Thu, 02 Sep 2010 08:23:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>ฟังก์ชั่น Replace Links ด้วย Regular expressions ของ PHP</title>
		<link>http://www.memo8.com/toolkits/archives/48</link>
		<comments>http://www.memo8.com/toolkits/archives/48#comments</comments>
		<pubDate>Sat, 12 Jan 2008 15:10:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Script]]></category>
		<category><![CDATA[Regular Expressions]]></category>

		<guid isPermaLink="false">http://www.memo8.com/toolkits/?p=48</guid>
		<description><![CDATA[ลักษณะการทำงานก็คือจะสร้างไฮเปอร์ลิงค์ให้โดยอัตโนมัติ
code
function replaceLinks($text) {

// convert support@pogoda.in into

// &#60;a href="mailto:support@pogoda.in"&#62;

// support@pogoda.in&#60;/a&#62;

$text = ereg_replace('[-a-z0-9!#$%&#38;\'*+/=?^_`{&#124;}~]+@([.]?[a-zA-Z0-9_/-])*',

'&#60;a href="mailto:\\0"&#62;\\0&#60;/a&#62;',$text);// convert http://www.pogoda.in/new_york/eng/ into

// &#60;a href="http://pogoda.in/new_york/eng/"&#62;

// pogoda.in/new_york/eng/&#60;/a&#62;

$text = ereg_replace('[a-zA-Z]+://(([.]?[a-zA-Z0-9_/-])*)',

'&#60;a href="\\0"&#62;\\1&#60;/a&#62;',$text);

// convert www.pogoda.in/new_york/eng/ into

// &#60;a href="http://www.pogoda.in/new_york/eng/"&#62;

// www.pogoda.in/new_york/eng/&#60;/a&#62;

$text = ereg_replace('(^&#124; )(www([-]*[.]?[a-zA-Z0-9_/-?&#38;%])*)',

' &#60;a href="http://\\2"&#62;\\2&#60;/a&#62;',$text);

return $text;

}
Example
echo replaceLinks('mailto:tatump@memo8.com');
echo"&#60;br /&#62;";
echo replaceLinks('http://www.memo8.com/toolkits/')
หรือจะเอาไปดัดแปลงเป็นการอ่านมาจากไฟล์ก็ได้นะครับ
ที่มา : http://th2.php.net/eregi_replace 
]]></description>
			<content:encoded><![CDATA[<p>ลักษณะการทำงานก็คือจะสร้างไฮเปอร์ลิงค์ให้โดยอัตโนมัติ<br />
<strong>code</strong></p>
<pre class="code">function replaceLinks($text) {

// convert support@pogoda.in into

// &lt;a href="mailto:support@pogoda.in"&gt;

// support@pogoda.in&lt;/a&gt;

$text = ereg_replace('[-a-z0-9!#$%&amp;\'*+/=?^_`{|}~]+@([.]?[a-zA-Z0-9_/-])*',

'&lt;a href="mailto:\\0"&gt;\\0&lt;/a&gt;',$text);// convert http://www.pogoda.in/new_york/eng/ into

// &lt;a href="http://pogoda.in/new_york/eng/"&gt;

// pogoda.in/new_york/eng/&lt;/a&gt;

$text = ereg_replace('[a-zA-Z]+://(([.]?[a-zA-Z0-9_/-])*)',

'&lt;a href="\\0"&gt;\\1&lt;/a&gt;',$text);

// convert www.pogoda.in/new_york/eng/ into

// &lt;a href="http://www.pogoda.in/new_york/eng/"&gt;

// www.pogoda.in/new_york/eng/&lt;/a&gt;

$text = ereg_replace('(^| )(www([-]*[.]?[a-zA-Z0-9_/-?&amp;%])*)',

' &lt;a href="http://\\2"&gt;\\2&lt;/a&gt;',$text);

return $text;

}</pre>
<p><strong>Example</strong></p>
<pre class="code">echo replaceLinks('mailto:tatump@memo8.com');
echo"&lt;br /&gt;";
echo replaceLinks('http://www.memo8.com/toolkits/')</pre>
<p>หรือจะเอาไปดัดแปลงเป็นการอ่านมาจากไฟล์ก็ได้นะครับ</p>
<p>ที่มา : <a href="http://th2.php.net/eregi_replace" target="_blank">http://th2.php.net/eregi_replace </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.memo8.com/toolkits/archives/48/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ฟังก์ชั่น Regular expressions ของ PHP</title>
		<link>http://www.memo8.com/toolkits/archives/33</link>
		<comments>http://www.memo8.com/toolkits/archives/33#comments</comments>
		<pubDate>Sat, 29 Dec 2007 06:10:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Script]]></category>
		<category><![CDATA[Regular Expressions]]></category>

		<guid isPermaLink="false">http://www.memo8.com/toolkits/?p=33</guid>
		<description><![CDATA[
ereg : ใช้ค้นหาคำที่มีในข้อความที่ต้องการ
eregi : ใช้เหมือนกับ ereg แต่ case sensitive 
ereg_replace : ใช้ค้นหาคำแล้วแทนที่ด้วยคำที่กำหนด
eregi_replace : ใช้เหมือนกับ eregi แต่ case sensitive
split : ใช้ค้นหาคำที่กำหนด และคืนค่าในลักษณะ array
  spliti : ใช้เหมือนกับ split แต่ case sensitive

]]></description>
			<content:encoded><![CDATA[<ol>
<li><span style="font-size: 10pt; color: black; font-family: Symbol"><span><span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"></span></span></span><strong><span dir="ltr"><span style="color: black; font-family: Tahoma">ereg</span></span></strong><span style="color: black; font-family: Tahoma"><strong> </strong>: <span lang="TH">ใช้<u>ค้นหาคำ</u>ที่มีในข้อความที่ต้องการ</span></span></li>
<li><strong><span dir="ltr"><span style="color: black; font-family: Tahoma">eregi</span></span></strong><span style="color: black; font-family: Tahoma"><strong> </strong>: <span lang="TH">ใช้เหมือนกับ </span>ereg <span lang="TH">แต่ </span><u>case sensitive</u></span><span style="color: black; font-family: Tahoma"><span lang="TH"> </span><o:p></o:p></span><span style="font-size: 10pt; color: black; font-family: Symbol"><span></span></span></li>
<li><span style="font-size: 10pt; color: black; font-family: Symbol"><span></span></span><strong><span dir="ltr"><span style="color: black; font-family: Tahoma">ereg_replace</span></span></strong><span style="color: black; font-family: Tahoma"> : <span lang="TH">ใช้<u>ค้นหาคำแล้วแทนที่</u>ด้วยคำที่กำหนด</span></span></li>
<li><span dir="ltr"><span style="color: black; font-family: Tahoma"><strong>eregi_replace</strong> </span></span><span style="color: black; font-family: Tahoma">: <span lang="TH">ใช้เหมือนกับ </span>eregi <span lang="TH">แต่ </span><u>case sensitive</u></span></li>
<li><strong><span dir="ltr"><span style="color: black; font-family: Tahoma">split</span></span></strong><span style="color: black; font-family: Tahoma"><strong> </strong>: <span lang="TH">ใช้<u>ค้นหาคำที่กำหนด</u> และคืนค่าในลักษณะ </span>array</span></li>
<li><span style="font-size: 10pt; color: black; font-family: Symbol"><span><span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal">  </span></span></span><strong><span dir="ltr"><span style="color: black; font-family: Tahoma">spliti</span></span></strong><span style="color: black; font-family: Tahoma"><strong> </strong>: <span lang="TH">ใช้เหมือนกับ </span>split <span lang="TH">แต่ </span><u>case sensitive</u></span></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.memo8.com/toolkits/archives/33/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
