Crosstips.org

My fun Crossword solver project. Crosstips.org & Krysstips.se

Kung Fu

Fujian White Crane Kung Fu

Fry-IT

Fry-IT is the company I work for

Photos

Photoalbum, both old and new.

Zope

What I have and am doing with Zope

Receptsamlingen

In Swedish only. About my "Collection of Recipes" website.

Contact me

My contact details and how to contact me.

 

Interested in buying ad space on this blog?
You can, on BuySellAds.com

KungFuPeople.com
Do you train Kung Fu?
Or know someone who does?
Then check out KungFuPeople.com


Mobile version of this page Mobile version of this page


 

You searched for keyword:regular expression
 

found 0 photos and 5 blogs in and 0 blog comments in 0.00 seconds



 

Blogs

  Recon - Regular Expression Test Console - 14th of January 2004

This is a fantastic little Python GUI using Tkinter, for testing your regular expressions in Python. You first paste or write in some text, then you doodle some regular expressions to see the outcome. What I do miss is exporting of actual code. Usually when I write my regular expression I fire up the interactive shell from which I can copy code when I'm happy with it. Like this:

 >>> import re
 >>> e=re.compile(r'\?q=(.*?)&', re.I)
 >>> print e.findall("http://www.google.com.br/search?q=paper+plane&hl=pt-BR")
 ['paper+plane']

  Anti-spamming email harvesting - 26th of February 2004

Stu's Site has a nice example of a way of preventing email harvesting by writing the email in reverse and then letting stylesheets reverse it when rendering. The HTML source looks like this:

 <style type="text/css">
 .backwards {unicode-bidi:bidi-override; direction: rtl;}
 </style>
 <span class="backwards">ku.oc.u7s@uts</span>

  \b in Python regular expressions - 14th of June 2005

Boy did that shut me up! The \b special character i python regular expressions is so useful. I've used it before but have forgotten about it. The following code:

 def createStandaloneWordRegex(word):
    """ return a regular expression that can find 'peter'
    only if it's written alone (next to space, start of 
    string, end of string, comma, etc) but not if inside 
    another word like peterbe """

    return re.compile(r"""
      (
      ^ %s
      (?=\W | $)
      |
      (?<=\W)
      %s
      (?=\W | $)
      )
      """
% (re.escape(word), re.escape(word)),
            re.I|re.L|re.M|re.X)

  \B in Python regular expressions - 23rd of July 2005

Today I learnt about how to use the \B gadget in Python regular expressions. I've previously talked about the usefulness of \b but there's a big benefit to using \B sometimes too.

  Python regular expression tester - 19th of September 2005

I've just discovered retest by Christof Hoeke which is a developers tool for testing and experimenting with regular expressions. It doesn't have a GUI so it uses SimpleHTTPServer to serve a web interface on http://localhost:8087 that uses AJAX to make the interface snappier. You use this if you feel uncertain how to write your regular expression syntax and need a helpful sandbox for playing in.