<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr</title>
<link>http://snipplr.com/language/php/tags/regular</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Thu, 20 Jun 2013 04:25:21 GMT</pubDate>
<item>
<title>(PHP) Remove superfluous line breaks between HTML elements. - pumpkinthehead</title>
<link>http://snipplr.com/view/65826/remove-superfluous-line-breaks-between-html-elements/</link>
<description><![CDATA[ <p>A regular expression for removing  and  (case insensitive) between HTML elements if there is no content between the HTML elements.  It was written for fixing extra line spaces created in a WordPress visual editor after the content of the visual editor was returned from the PHP nl2br() method.</p> ]]></description>
<pubDate>Wed, 27 Jun 2012 08:18:51 GMT</pubDate>
<guid>http://snipplr.com/view/65826/remove-superfluous-line-breaks-between-html-elements/</guid>
</item>
<item>
<title>(PHP) Remove / Replace - href / anchor /link - in html /string - preg_replace - php - regex - regular expression - rwunsch</title>
<link>http://snipplr.com/view/63981/remove--replace--href--anchor-link--in-html-string--pregreplace--php--regex--regular-expression/</link>
<description><![CDATA[ <p>Replaces all links within href part of anchor in a HTML-String.</p> ]]></description>
<pubDate>Sat, 17 Mar 2012 03:20:17 GMT</pubDate>
<guid>http://snipplr.com/view/63981/remove--replace--href--anchor-link--in-html-string--pregreplace--php--regex--regular-expression/</guid>
</item>
<item>
<title>(PHP) URLs in Text, and Parsing them into Hyperlinked HTML urls - aamirrajpoot</title>
<link>http://snipplr.com/view/58653/urls-in-text-and-parsing-them-into-hyperlinked-html-urls/</link>
<description><![CDATA[ <p>Try something like this.

$pattern = "/http:\/\/(www\.)?([^.]+\.[^.\s]+\.?[^.\s]*)/i";
$replace = "http://\\1\\2";
$string = [url=http://us2.php.net/preg-replace]preg_replace[/url]($pattern,$replace,$string);
echo $string;

Where $string is the text. Just a couple notes about this pattern:
1) The URI MUST have "http://" before it
2) It works for URIs formatted in the following ways
>>>http://www.example.foo
>>>http://www.example.foo.foo #having two
>>>http://example.foo
>>>http://example.foo.foo #having two
>>>http://foo.exmaple.foo #pretty much the same as above</p> ]]></description>
<pubDate>Wed, 14 Sep 2011 00:20:15 GMT</pubDate>
<guid>http://snipplr.com/view/58653/urls-in-text-and-parsing-them-into-hyperlinked-html-urls/</guid>
</item>
<item>
<title>(PHP) Clean User Submitted URL's - Entherman</title>
<link>http://snipplr.com/view/58063/clean-user-submitted-urls/</link>
<description><![CDATA[ <p>Useful when using user-submitted URLs</p> ]]></description>
<pubDate>Sun, 21 Aug 2011 01:35:35 GMT</pubDate>
<guid>http://snipplr.com/view/58063/clean-user-submitted-urls/</guid>
</item>
<item>
<title>(PHP) Replace URLs with links - PHP - plesh</title>
<link>http://snipplr.com/view/56479/replace-urls-with-links--php/</link>
<description><![CDATA[ <p>A really handy snippet that will replace textual URLs with HTML links.

Also works for email addresses.</p> ]]></description>
<pubDate>Tue, 12 Jul 2011 22:37:53 GMT</pubDate>
<guid>http://snipplr.com/view/56479/replace-urls-with-links--php/</guid>
</item>
<item>
<title>(PHP) Get Width and Height From a Filename - brownrl</title>
<link>http://snipplr.com/view/48846/get-width-and-height-from-a-filename/</link>
<description><![CDATA[ <p>I use this little guy to get the width and height from a filename. Often when I need to show a flash swf file I don't have an easy way to tell the width and the height of the file for display. However is the file name is "some_flash_file 300x250.swf" then this litte guy will help a lot.</p> ]]></description>
<pubDate>Fri, 11 Feb 2011 19:56:04 GMT</pubDate>
<guid>http://snipplr.com/view/48846/get-width-and-height-from-a-filename/</guid>
</item>
<item>
<title>(PHP) PHP : expressions regulieres les plus courantes et exemple de test avec ereg() - alexandrepayet</title>
<link>http://snipplr.com/view/39135/php--expressions-regulieres-les-plus-courantes-et-exemple-de-test-avec-ereg/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Mon, 16 Aug 2010 21:43:33 GMT</pubDate>
<guid>http://snipplr.com/view/39135/php--expressions-regulieres-les-plus-courantes-et-exemple-de-test-avec-ereg/</guid>
</item>
<item>
<title>(PHP) Comfortable directory contents with filters - Lostindream</title>
<link>http://snipplr.com/view/29720/comfortable-directory-contents-with-filters/</link>
<description><![CDATA[ <p>Very simple to use.

**Calling:**

    $files = dirContents(DIR_PATH, [FILTER, [TYPE]]);

**Examples:**

    $files = dirContens("my-dir");
_$files_ is array containing all, both files either directories

    $files = dirContens("my-dir", "img[0-9]");
_$files_ is array containing files or directories with 'img0', 'img1', 'img2', etc. in their names

    $files = dirContents("my-dir/", "\.php", 1);
_$files_ is array containing only files with '.php' in their names

**Tip:**
After calling _dirContents()_ try to call *print_r* for showing the array of files

    echo '';
    print_r($files);
    echo '';

Thank you for your comments.</p> ]]></description>
<pubDate>Sat, 13 Mar 2010 14:24:14 GMT</pubDate>
<guid>http://snipplr.com/view/29720/comfortable-directory-contents-with-filters/</guid>
</item>
<item>
<title>(PHP) PHP parse url, mailto, and also twitter’s usernames and arguments - ginoplusio</title>
<link>http://snipplr.com/view/29556/php-parse-url-mailto-and-also-twitters-usernames-and-arguments/</link>
<description><![CDATA[ <p>This small function receive a text as input and returns an html text with links if the source text contains urls (http://www… but also ftp://… and every other protocol), emails, twitter’s usernames (with @ at the beginning) and also twitter tags (with # at the beginning).</p> ]]></description>
<pubDate>Wed, 10 Mar 2010 14:43:43 GMT</pubDate>
<guid>http://snipplr.com/view/29556/php-parse-url-mailto-and-also-twitters-usernames-and-arguments/</guid>
</item>
<item>
<title>(PHP) Convert text to link - yazu</title>
<link>http://snipplr.com/view/25060/convert-text-to-link/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Sat, 19 Dec 2009 04:07:17 GMT</pubDate>
<guid>http://snipplr.com/view/25060/convert-text-to-link/</guid>
</item>
<item>
<title>(PHP) Regular expression to match a Slug - rupakdhiman</title>
<link>http://snipplr.com/view/24360/regular-expression-to-match-a-slug/</link>
<description><![CDATA[ <p>This is a regular expression to match a Slug. Slug that contains hyphens ("-").</p> ]]></description>
<pubDate>Sun, 06 Dec 2009 12:25:09 GMT</pubDate>
<guid>http://snipplr.com/view/24360/regular-expression-to-match-a-slug/</guid>
</item>
<item>
<title>(PHP) Regular expression to match an HTML Tag - rupakdhiman</title>
<link>http://snipplr.com/view/24358/regular-expression-to-match-an-html-tag/</link>
<description><![CDATA[ <p>This is an regular expression to match an HTML Tag from a given input.</p> ]]></description>
<pubDate>Sun, 06 Dec 2009 12:14:52 GMT</pubDate>
<guid>http://snipplr.com/view/24358/regular-expression-to-match-an-html-tag/</guid>
</item>
<item>
<title>(PHP) Regular expression to match an IP Address - rupakdhiman</title>
<link>http://snipplr.com/view/24357/regular-expression-to-match-an-ip-address/</link>
<description><![CDATA[ <p>This is a code to match an IP Address from a source.</p> ]]></description>
<pubDate>Sun, 06 Dec 2009 12:10:16 GMT</pubDate>
<guid>http://snipplr.com/view/24357/regular-expression-to-match-an-ip-address/</guid>
</item>
<item>
<title>(PHP) PHP: remove anchors and other tags from the intro with regular expression - hasantayyar</title>
<link>http://snipplr.com/view/17735/php-remove-anchors-and-other-tags-from-the-intro-with-regular-expression/</link>
<description><![CDATA[ <p>"Recently I was playing around with WordPress’ wp_posts table. I wanted to grab the basic information about my posts (ID, title, content, slug) and build a quick summary list of them. One problem I ran into was creating a content “intro.” Luckily a quick regular expression allowed me to create the intro."</p> ]]></description>
<pubDate>Fri, 31 Jul 2009 12:32:30 GMT</pubDate>
<guid>http://snipplr.com/view/17735/php-remove-anchors-and-other-tags-from-the-intro-with-regular-expression/</guid>
</item>
<item>
<title>(PHP) Regular Expression to get contents of div[id] - Gustavs</title>
<link>http://snipplr.com/view/15302/regular-expression-to-get-contents-of-divid/</link>
<description><![CDATA[ <p>This allows you to get contents of any div with ID tag. 
$matches[0] returns with parent div tag
$matches[1] returns with out parent div tag</p> ]]></description>
<pubDate>Mon, 25 May 2009 07:41:24 GMT</pubDate>
<guid>http://snipplr.com/view/15302/regular-expression-to-get-contents-of-divid/</guid>
</item>
<item>
<title>(PHP) Remove URLs from String - smoover</title>
<link>http://snipplr.com/view/15236/remove-urls-from-string/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Fri, 22 May 2009 10:07:52 GMT</pubDate>
<guid>http://snipplr.com/view/15236/remove-urls-from-string/</guid>
</item>
<item>
<title>(PHP) semi-live regexp previewer - MMDeveloper</title>
<link>http://snipplr.com/view/13858/semilive-regexp-previewer/</link>
<description><![CDATA[ <p>input your regexp expression and submit it. It will return the supplied text with the matched results highlighted. A sample regex pattern to submit would be:

[aqtrew]
which would highlight all instances of the letters a,q,t,r,e, and w

[^a-zA-Z 0-9]
which would highlight all the punctuation.

Essentially you are inputting everything between the //'s for your match.</p> ]]></description>
<pubDate>Tue, 07 Apr 2009 12:25:29 GMT</pubDate>
<guid>http://snipplr.com/view/13858/semilive-regexp-previewer/</guid>
</item>
<item>
<title>(PHP) preg_match for Hexadecimal Strings - duniyadnd</title>
<link>http://snipplr.com/view/12113/pregmatch-for-hexadecimal-strings/</link>
<description><![CDATA[ <p>Figure out if the string possesses only hexadecimal characters in the string. If not, fail. Remember, white spaces are not hexadecimal, so make sure you trim() your strings before you send it in or explode your string.</p> ]]></description>
<pubDate>Wed, 11 Feb 2009 11:00:25 GMT</pubDate>
<guid>http://snipplr.com/view/12113/pregmatch-for-hexadecimal-strings/</guid>
</item>
<item>
<title>(PHP) isValidPostCode - Scooter</title>
<link>http://snipplr.com/view/7989/isvalidpostcode/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Sat, 23 Aug 2008 10:28:31 GMT</pubDate>
<guid>http://snipplr.com/view/7989/isvalidpostcode/</guid>
</item>
<item>
<title>(PHP) isValidZipCode - Scooter</title>
<link>http://snipplr.com/view/7786/isvalidzipcode/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Sat, 09 Aug 2008 11:00:56 GMT</pubDate>
<guid>http://snipplr.com/view/7786/isvalidzipcode/</guid>
</item>
</channel>
</rss>