Mar 24 2007

Regular expressions vol.1

Published by antonello under Ajax, Apache, Java, Php, Python, Regex, WebMaster

Validazione email - Email validation:
^[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*@[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*(.[a-z]{2,3})$

Parsing file di log di Apache - Apache log parsing:
(\d+\.\d+\.\d+\.\d+) (-|\w*) (-|\w*) \[(\d+\/\w+\/\d+):(\d+:\d+:\d+) -(\d\d\d\d)\] “([^"]*)” (\d+) (-|\d+) “([^"]*)” “(.*)”\s*\Z

se utilizzate python è estremamente utile compilare l’espressione regolare che ho appena scritto in questo modo:
myregex = re.compile('(?P\d+\.\d+\.\d+\.\d+) (?P-|\w*) (?P-|\w*) \[(?P\d+\/\w+\/\d+):(?P

in questo modo utilizzando questo codice:

log = self.regex.match(row)
log_line = log.groupdict()

nella variabile log_line otterrete un dizionario contenente come chiavi i valori che avete inserito nella fase di compilazione come ?P e come valore la relativa sottostringa, ad esempio log_line['ip'] = valore ip .

convert this post to pdf.

2 responses so far

Mar 23 2007

Categoria Regex

Published by antonello under News, Regex Tags:

Salve a tutti, ho deciso di aprire la categoria Regex, per fornire a tutti i programmatori, che come me non conoscono troppo a fondo il fantastico mondo delle espressioni regolari, un punto di ritrovo nel quale condividere le proprie conoscenze riportando espressioni regolari di uso più comune con esempi di utilizzo, che poi man mano provvederò ad elencare nei post di questa categoria.

Potrete inviarmi le vostre espressioni regolari via mail o inserendo un commento in un post qualunque della categoria regex.

Buona raccolta a tutti!

No responses yet

Feb 14 2007

old lady revenge

Published by antonello under Uncategorized Tags:

La vecchietta si vendica…

The old lady revenge…

Continue Reading »

No responses yet

Feb 06 2007

post2pdf update 0.2

Published by antonello under News, Wordpress Tags:

Great news, version 0.2 of post2pdf is finally out…

You can find in the new version some usefull addons as:

  • Visual editor button to insert exclusion tag
  • Html table support
  • Image support improved with a best effort techinque
  • Category exportation

I hope you will like it… read more about it

5 responses so far

Feb 05 2007

Inkscape web2.0 icons

Published by antonello under Guide, Web2.0, WebMaster

Hi all, this is a good tutorial (screencast), that I have found on youtube, about how you can do to create a beautiful, plastic stile sphere icon for your website, using an open source tool for vector graphics Inkscape.

Those kind of images are particular appreciated in “web2.0 style” and many website are moving their graphics towards this style, so why don’t you keep updated?
Continue Reading »

4 responses so far

« Prev - Next »