864 links
  • Links Lounge
  • Home
  • Login
  • RSS Feed
  • Tag cloud
  • Picture wall
  • Daily
Links per page: 20 50 100
page 1 / 1
3 results tagged Sanitize x
  • Note : regex pour matcher les balises HTML et les attributs - Le Hollandais Volant - Links Lounge - Le Hollandais Volant

    Dingue, je suis lu :D
    J'ai re-testé le script de Timo et c'est impeccable en effet ! Enfin, sur les tests que j'ai effectué. Bien joué encore !

    Fri Mar 22 17:28:53 2013 - permalink -
    - - - http://lehollandaisvolant.net/index.php?mode=links&id=20130322142853
    HTML PHP Regex Sanitize
  • Note : regex pour matcher les balises HTML et les attributs - Le Hollandais Volant

    Ah oui les regex. Toujours galère en particulier pour parser du HTML; Je me demande si Le Hollandais Volant nous montrera un exemple d'utilisation.

    Personnellement, j'ai testé son script en utilisant le code de son article comme exemple (éhéh !). J'ai quelques balises de titre qui restent, mais c'est peut-être fait exprès... ?

    <div id="main">
        <section id="midle">
            <div id="posts">
            <article class="itembloc link" id="20130322003640">
        <hgroup class="post-hgr links-hgr">
            <h2 class="link-titre"><a href="index.php?mode=links&id=20130322003640">#5292</a> - <a href="http://lehollandaisvolant.net/?mode=links&id=20130322003640">Note : regex pour matcher les balises HTML et les attributs</a></h2>
            <h3 class="link-date">Aujourd’hui à 00:36:40</h3>
        </hgroup>
        <div class="post-cnt links-cnt">
            "#<\s*/?(?:[a-zA-Z-]+)(?: (?:\s*\w+=(['\"])(?:(?!\g{1}).|(?:(?<=\\\)\g{1}))+\g{1})*(?:\s*\w*\s*))?/?>#S"<br />
    <br />
    (en php, en gros : utiliser dans un preg_replace() et les remplacer par une chaine vide agira comme striptags().)<br />
    <br />
    (oui, les attributs peuvent contenir un « > » ou un « < », par exemple en JS : « 2<=4 », et c’est chiant).<br />
    <br />
    Un peu de doc complémtentaire :<br />
    <a href="http://www.regular-expressions.info/refadv.html">http://www.regular-expressions.info/refadv.html</a><br />
    <a href="http://stackoverflow.com/questions/6050427/regex-problem-with-backreference-in-pattern-with-preg-match-all/6051114#6051114">http://stackoverflow.com/questions/6050427/regex-problem-with-backreference-in-pattern-with-preg-match-all/6051114#6051114</a> (commentaire intéressant)<br />
    <a href="http://blog.lilhoot.eu/regex-et-preg-assertions-avant-arriere-lookahead-lookbehind-assertions-recuperer-les-chaines,a3">http://blog.lilhoot.eu/regex-et-preg-assertions-avant-arriere-lookahead-lookbehind-assertions-recuperer-les-chaines,a3</a> (en français, très intéressant et très clair)
        </div>
    </article>
    </div> <!-- end postS -->

    Devient :

    <h2 class="link-titre"> #5292  -  Note : regex pour matcher les balises HTML et les attributs </h2>
    <h3 class="link-date">Aujourd’hui à 00:36:40</h3>
    
    "#<\s*/?(?:[a-zA-Z-]+)(?: (?:\s*\w+=(['\"])(?:(?!\g{1}).|(?:(?<=\\\)\g{1}))+\g{1})*(?:\s*\w*\s*))?/?>#S" 
    
    (en php, en gros : utiliser dans un preg_replace() et les remplacer par une chaine vide agira comme striptags().) 
    
    (oui, les attributs peuvent contenir un « > » ou un « < », par exemple en JS : « 2<=4 », et c’est chiant). 
    
    Un peu de doc complémtentaire : 
     http://www.regular-expressions.info/refadv.html  
     http://stackoverflow.com/questions/6050427/regex-problem-with-backreference-in-pattern-with-preg-match-all/6051114#6051114  (commentaire intéressant) 
     http://blog.lilhoot.eu/regex-et-preg-assertions-avant-arriere-lookahead-lookbehind-assertions-recuperer-les-chaines,a3  (en français, très intéressant et très clair)
    <!-- end postS -->
    Fri Mar 22 09:15:56 2013 - permalink -
    - - - http://lehollandaisvolant.net/?mode=links&id=20130322003640
    HTML PHP Regex Sanitize
  • Sécuriser les chaines en PHP - Warrior du Dimanche

    Et si on n'a pas MySQL? Il faudrait que je check les bonnes pratiques à ce sujet.

    Fri Oct 5 00:42:17 2012 - permalink -
    - - - http://www.warriordudimanche.net/article30/securiser-les-chaines-en-php
    PHP Sanitize Security String
Links per page: 20 50 100
page 1 / 1
Shaarli - The personal, minimalist, super-fast, no-database delicious clone by the Shaarli community - Help/documentation