Welcome To Snipplr
Everyone's Recent Snippets Tagged regex
- All /
 - JavaScript /
 - HTML /
 - PHP /
 - CSS /
 - Ruby /
 - Objective C
 
By the legendary abigail.  Fails to match if and only if it is matched against a prime number of 1's.  That is, '11' fails, but '1111' does not.
I once heard him talk why this works, but I forgot most of it.
        
        
        
            3 
        
        
            1562 
        
                    posted 17 years ago by banzaiman
            This function uses the power of regexp to check if some bad word are on the text, also offers the posibility to change those word for something else. Examples:\r\n\r\n$texto = \'fuck off!\';\r\nfiltrado($texto); returns true since a bad word has been...
        
        
        
            1 
        
        
            1477 
        
                    posted 17 years ago by oso96_2000
            Worst title ever.  Basically, this takes a string like:
"Check this out: http://snipplr.com/view/5759/replace-a-url-its-domain-name-and-create-link/" and replaces it with "Check this out: snipplr.com [with a link to the full URL]"
        
        
        
            1 
        
        
            1820 
        
                    posted 17 years ago by jaytee
            This function can validate and parse UK postcode like SW1A 1AA in to formated array.
        
        
        
            2 
        
        
            1875 
        
                    posted 17 years ago by naz
            When processing text for a search engine or analysis tool, code needs to strip out punctuation, formatting, spacing, and control characters to reveal indexable text. In international text there are hundreds of these characters, and some should be rem...
        
        
        
            1 
        
        
            1495 
        
                    posted 17 years ago by localhorst
            Easy functions, comments in code.
From:  http://www.ilovejackdaniels.com/asp/vbscript-regular-expressions/
        
        
        
            1 
        
        
            1296 
        
                    posted 17 years ago by jc001
            \Q...\E perl quoting means no ugly escaping in the regex. find's -print0 with xargs -0 is the secret to handling files with spaces in their names.
        
        
        
            1 
        
        
            1724 
        
                    posted 17 years ago by ches
            This makes it easy to retrieve certain value from a url with different values appended to it.
        
        
        
            0 
        
        
            1443 
        
                    posted 17 years ago by iTony
            Remove excess whitespaces from string
Remove espaços em branco em excesso de uma string
        
        
        
            1 
        
        
            1387 
        
                    posted 17 years ago by rafaelmt
            Everything is either true or untrue, or both true and untrue, or neither true nor untrue - nagarguna
        
        
        
            2 
        
        
            1915 
        
                    posted 17 years ago by zvasanth
            I use in textmate / e to convert whitespace to underscores.
        
        
        
            6 
        
        
            1423 
        
                    posted 17 years ago by lagrangeapex
            Use this to sanitize a string and convert all wierd characters to your choice of delimiter
        
        
        
            1 
        
        
            1226 
        
                    posted 18 years ago by vanne