View Single Post
Old 08-20-2011, 09:52 AM   #11
kacir
Wizard
kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.
 
kacir's Avatar
 
Posts: 3,463
Karma: 10684861
Join Date: May 2006
Device: PocketBook 360, before it was Sony Reader, cassiopeia A-20
Quote:
Originally Posted by mightymouse2045 View Post
Thanks alot for your explanation - that worked a treat I can now do that with anything else in future
Complicated regular expressions (like the one above) can be quite ... intimidating. This is because the Regular Expression language is very, very condensed and has developed during many years, so some metacharacters need to be "escaped", others not, and syntax is different for traditional metacharacters and different for relatively recently introduced ones. The syntax can change from tool to tool.

If you "take the RE apart", like I did above, it becomes much clearer.
As I said, the RE language is very "dense", so such expressions are very often jokingly referred to as "write only". It means it can be easier to write it than understand expression that somebody else wrote.

I strongly recommend that you read following post
https://www.mobileread.com/forums/sho...d.php?t=118569
It is a result of very interesting thread that was started by Manichean, with many contributors and is now part of the Calibre documentation.

If you are interested in further learning, get a book called Mastering Regular Expressions by By Jeffrey E.F. Friedl.
kacir is offline   Reply With Quote