<html><head></head><body bgcolor="#FFFFFF"><div><br></div><div>Il giorno 28/lug/2012, alle ore 22:40, Daniele Varrazzo <<a href="mailto:piro@develer.com">piro@develer.com</a>> ha scritto:</div><div><br></div><blockquote type="cite">
<div><span>No, anzi, grazie per questo capolavoro!</span><br></div></blockquote><br><div>E allora mi sento in dovere di copia-incollare il paragrafo di un famosissimo libro :-)</div><div><br></div><div>Ciao.</div><div>Marco.</div>
<div><br></div><div><br></div><div class="page" title="Page 187"><div class="layoutArea"><div class="column">
                                        <p><span style>Ma.attenzione.a.non.esagerare!
</span></p>
                                        <p><span style="font-size:10.000000pt;font-family:'Myriad'">Esiste un detto famoso riguardante le regular expression:
</span></p>
                                        <p><span style="font-size:10.000000pt;font-family:'Myriad';font-style:italic">Un tizio aveva un problema e disse "So come risolverlo: userò una regular
expression!". E così il tizio ebbe due problemi...
</span></p>
                                        <p><span style="font-size:10.000000pt;font-family:'Myriad'">Non crediamo che sia così, però bisogna fare attenzione a usare le re-
gular expression per quello che sono, senza esagerare.
</span></p>
                                        <p><span style="font-size:10.000000pt;font-family:'Myriad'">Come ultimo esempio vogliamo dare un'occhiata a una regular ex-
pression che forse non rispetta il consiglio di non esagerare.
</span></p>
                                        <p><span style="font-size:10.000000pt;font-family:'Myriad'">Si tratta di una regular expression che controlla la correttezza di un
indirizzo email:
</span></p>
                                        <pre><span style="font-size:8.000000pt;font-family:'MCPdigital'">   ^((([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|/|=|\?|\^|_|`|
   \{|\||\}|~)+(\.([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|/|
   =|\?|\^|_|`|\{|\||\}|~)+)*)@((((([a-z]|[0-9])([a-z]
   |[0-9]|\-){0,61}([a-z]|[0-9])\.))*([a-z]|[0-9])([a-
   z]|[0-9]|\-){0,61}([a-z]|[0-9])\.(af|ax|al|dz|as|ad
   |ao|ai|aq|ag|ar|am|aw|au|at|az|bs|bh|bd|bb|by|be|bz
   |bj|bm|bt|bo|ba|bw|bv|br|io|bn|bg|bf|bi|kh|cm|ca|cv
   |ky|cf|td|cl|cn|cx|cc|co|km|cg|cd|ck|cr|ci|hr|cu|cy
   |cz|dk|dj|dm|do|ec|eg|sv|gq|er|ee|et|fk|fo|fj|fi|fr
   |gf|pf|tf|ga|gm|ge|de|gh|gi|gr|gl|gd|gp|gu|gt|gg|gn
   |gw|gy|ht|hm|va|hn|hk|hu|is|in|id|ir|iq|ie|im|il|it
   |jm|jp|je|jo|kz|ke|ki|kp|kr|kw|kg|la|lv|lb|ls|lr|ly
   |li|lt|lu|mo|mk|mg|mw|my|mv|ml|mt|mh|mq|mr|mu|yt|mx
   |fm|md|mc|mn|ms|ma|mz|mm|na|nr|np|nl|an|nc|nz|ni|ne
   |ng|nu|nf|mp|no|om|pk|pw|ps|pa|pg|py|pe|ph|pn|pl|pt
   |pr|qa|re|ro|ru|rw|sh|kn|lc|pm|vc|ws|sm|st|sa|sn|cs
   |sc|sl|sg|sk|si|sb|so|za|gs|es|lk|sd|sr|sj|sz|se|ch
   |sy|tw|tj|tz|th|tl|tg|tk|to|tt|tn|tr|tm|tc|tv|ug|ua
   |ae|gb|us|um|uy|uz|vu|ve|vn|vg|vi|wf|eh|ye|zm|zw|co
   m|edu|gov|int|mil|net|org|biz|info|name|pro|aero|co</span><span class="Apple-style-span" style>op </span></pre><pre><span class="Apple-style-span" style>   |museum|arpa))|(((([0-9]){1,3}\.){3}([0-9]){1,3})</span></pre>
<pre><span style="font-size:8.000000pt;font-family:'MCPdigital'"><div class="page" title="Page 188">
                        <div class="layoutArea">
                                <div class="column">
                                        <p><span style="font-size:10.000000pt;font-family:'Myriad'">1 Appendice B
</span></p>
                                </div>
                        </div>
                        <img src="cid:/page188image1196" alt="page188image1196" width="275.460999" height="0.500000">
                        </div></span><span style="font-size:8.000000pt;font-family:'MCPdigital'"><div class="page" title="Page 188"><div class="layoutArea">
                                </div></div></span><span style="font-size:8.000000pt;font-family:'MCPdigital'"><div class="page" title="Page 188"><div class="layoutArea"><div class="column">
                                        <pre><span style="font-size:8.000000pt;font-family:'MCPdigital'">   )|(\[((([0-9]){1,3}\.){3}([0-9]){1,3})\])))$
</span></pre>
                                        <p><span style="font-size:10.000000pt;font-family:'Myriad';font-style:italic">Questo capolavoro di ingegnosità (e di costanza) è dovuto ad
un certo Philippe Benthien che l'ha inserito nel sito </span><span style="font-size:8.000000pt;font-family:'MCPdigital'"><a href="http://re-">http://re-</a>
<a href="http://gexlib.com">gexlib.com</a>
</span></p>
                                        <p><span style="font-size:10.000000pt;font-family:'Myriad'">Siamo sicuri che questa regular expression controlla alla perfezione la
correttezza formale di un indirizzo email.
</span></p>
                                        <p><span style="font-size:10.000000pt;font-family:'Myriad'">Però se il signor Mario Rossi, il cui indirizzo è </span><span style="font-size:8.000000pt;font-family:'MCPdigital'"><a href="mailto:mario.rossi@posta.it">mario.rossi@posta.it</a>
</span><span style="font-size:10.000000pt;font-family:'Myriad'">scrivesse per errore </span><span style="font-size:8.000000pt;font-family:'MCPdigital'"><a href="mailto:mario.risso@posta.it">mario.risso@posta.it</a>, </span><span style="font-size:10.000000pt;font-family:'Myriad'">la regular expression non
gli direbbe che ha sbagliato. Viceversa il signor John Smith. il cui indi-
rizzo email è </span><span style="font-size:8.000000pt;font-family:'MCPdigital'"><a href="mailto:john.smith@people.mobi">john.smith@people.mobi</a>, </span><span style="font-size:10.000000pt;font-family:'Myriad'">non potrebbe inserire il suo
indirizzo se il controllo fosse affidato a questa regular expression...
</span></p>
                                        <p><span style="font-size:10.000000pt;font-family:'Myriad';font-style:italic">Per la cronaca </span><span style="font-size:8.000000pt;font-family:'MCPdigital'">.mobi </span><span style="font-size:10.000000pt;font-family:'Myriad';font-style:italic">è un dominio di primo livello introdotto nel 2006.
</span></p><br></div></div></div></span></pre>
                                </div>
                        </div>
                </div></body></html>