Kwissle

My real-time quiz battle game Kwissle.com

Crosstips.org

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

Kung Fu

Fujian White Crane Kung Fu

Photos

Photoalbum, both old and new.

Twitter

Follow me on Twitter

Contact me

My contact details and how to contact me.

 

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

Previous:
IssueTrackerProduct 0.6.6
Next:
London Review of Personals

Related by category

Python

 
Python

Jacobian highlighter

http://www.peterbe.com/plog/jacobian-highlighter/highlight.html

1st of May 2005

My friend Jacob from Galdrion taught me about "positive lookbehind assertion" and "lookahead assertion" when writing regular expressions in Python. It was new to me and I can't believe why I didn't read up on this more earlier because they're really useful. I've now got a usage for these which I use to find words that written on their own. For example, in the string "peterbe" the word "peter" doesn't exist really. You only want to find your words when they're written alone. You can't rely on it being spaces always on both sides either. You might find brackets, fullstops, end-of-string, you name it.

Enough chatting about it, I have now put together a little something that does this properly which I for no real reason call:

the Jacobian highlighter

Please give it a spin to see if it behaves like you expect it too. If you find any problems, let me know and I'll fix it and add them to the unit tests.

Next on the todo list for this is Unicode support of course.



Comment

Anonymous - 2nd May 2005  [«« Reply to this]
You might be interested in the \b pattern which matches the break at the beginning or end of a word.
Peter Bengtsson - 14th June 2005   [«« Reply to this]
Forgot about that one and will try to use it instead of the currently complicated one.
 
Name:
Email:
hide my email address.

Your email address will be encoded to prevent email-extraction spiders from reading it so you won't get spammed if you decide to show your email address.