IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

Problème pour trouver la bonne regex remplacement d'une ligne [RegEx]


Sujet :

Langage PHP

  1. #1
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mars 2010
    Messages
    11
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2010
    Messages : 11
    Points : 7
    Points
    7
    Par défaut Problème pour trouver la bonne regex remplacement d'une ligne
    Bonjour, mon problème est simple. Le xml de la génération d'une page donne à chaque fois ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     <a  href="http://www.magic-recettes.com/cuisine/desserts-glaces-creme-glacee-au-caramel-et-beurre-sale/803/17427.asp?xtor=EPR-41" style="font-weight: bold; color: rgb(102, 102, 102); text-decoration: none;" title="Magic recettes">
    J'aimerais changer la valeur du xtor à xtor = EPR-36.
    Il y a plusieurs xtor dans la page donc je n'aimerai changer que celui-ci.

    La valeur du title est toujours la même : je pensais donc baser ma regex dessus, en faisant un truc du style :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    	  if(preg_match('#title="Magic recettes"#',$lc_contents)) { ... }
    Mais le problème c'est que si je fais :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $lc_contents=str_replace ('EPR-36','EPR-41',  $lc_contents);
    Cela va me changer quand même tous les xtor de la page.

    Comment faire ?
    Merci beaucoup de votre aide ...

  2. #2
    Membre averti Avatar de Nheo_
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2011
    Messages
    323
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2011
    Messages : 323
    Points : 416
    Points
    416
    Par défaut
    Bonjour,

    Peux-tu donner le code complet de la page s'il te plait ?

  3. #3
    Expert éminent
    Avatar de transgohan
    Homme Profil pro
    Développeur Temps réel Embarqué
    Inscrit en
    Janvier 2011
    Messages
    3 146
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Maine et Loire (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur Temps réel Embarqué

    Informations forums :
    Inscription : Janvier 2011
    Messages : 3 146
    Points : 9 386
    Points
    9 386
    Par défaut
    Parser du XML => SimpleXML (parmi tant d'autres)
    Puis XPath pour trouver le bon node.
    Et modification du node comme on modifierai une variable.

  4. #4
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mars 2010
    Messages
    11
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2010
    Messages : 11
    Points : 7
    Points
    7
    Par défaut
    Citation Envoyé par Nheo_ Voir le message
    Bonjour,

    Peux-tu donner le code complet de la page s'il te plait ?
    Le code source en soit est un peu long ...
    Mais si tu veux :




    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
    <title>Soldes sp&eacute;cial Grossesse &gt; Fermeture maternit&eacute; &gt; Pr&eacute;noms de cin&eacute;ma</title>
    </head>
    <body bgcolor="#ffffff">
    <table width="600" align="center" border="0" cellpadding="0" cellspacing="0">
    <tbody><tr>
    <td align="center"><span class="mirroir" style="font-family: arial; font-size: 10px; color: #000000; text-align: center;">Pour &ecirc;tre certain de recevoir cette newsletter, ajoutez l'adresse<br>

    d'exp&eacute;dition <u><a href="mailto:info@e.magicmaman.com" target="_blank" class="lien" style="font-family: arial; color: #000000; font-size: 10px; text-decoration: none;">info@e.magicmaman.com</a></u> &agrave; votre carnet d'adresse.<br>&lt;%@ include view="mirrorPageMMGrossesse" %&gt;</span></td>
    </tr>
    </tbody></table>
    <table style="border: 2px solid rgb(221, 132, 178);" width="612" align="center" bordercolor="#DE86B5" cellpadding="0" cellspacing="0">
    <tbody><tr>
    <td width="613">

    <table width="612" align="center" border="0" cellpadding="0" cellspacing="0">
    <tbody><tr>
    <td width="213"><img src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/HeaderMM.gif" alt="" width="213" height="81"></td>
    <td width="80">&nbsp;</td>
    <td width="319"><span style="font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#393442">Vos informations de connexion &agrave; Magicmaman. com : <br>Identifiant : <strong><span style="font-size:11px">&lt;%= user.comp.DTM_PSEUDO %&gt;</span></strong><br>
    <br>
    Modifier mes informations personnelles : <strong><span style="font-size:11px"><a href="http://www.magicmaman.com/direct/membre/connect?emailAddress=<%= user.recipient.email %>&amp;authenticationKey=<%= user.comp.autoconnectmd5 %>&amp;redirectURL=http://www.magicmaman.com/membre/profil&amp;xtor=EPR-41" target="_blank" style="color:#393442" title="Modifier mes informations personnelles">Cliquez ici</a></span></strong></span></td>

    </tr>
    <tr>
    <td colspan="3" alt="" height="43"><table width="612" border="0" cellpadding="0" cellspacing="0">
    <tbody><tr>
    <td width="10">&nbsp;</td>
    <td width="81"><a href="http://www.magicmaman.com/actualite.php?rubrique=2218&amp;xtor=EPR-41" border="0" title="Actualit&eacute;s"><img style="display: inline;" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/menu_01.jpg" alt="Actualit&eacute;s" title="Actualit&eacute;s" width="81" border="0" height="45"></a></td>
    <td width="86"><a href="http://www.magicmaman.com/grossesse-accouchement-naissance,34.asp2?xtor=EPR-41" border="0" title="Grossesse"><img style="display: inline;" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/menu_02.jpg" alt="grossesse" title="Grossesse" width="86" border="0" height="45"></a></td>
    <td width="98"><a href="http://www.magicmaman.com/bebe-nourrisson-eveil-parents,38.asp2?xtor=EPR-41" border="0" title="B&eacute;b&eacute;"><img style="display: inline;" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/menu_03.jpg" alt="B&eacute;b&eacute; 0-3 ans" title="B&eacute;b&eacute; 0-3 ans" width="98" border="0" height="45"></a></td>
    <td width="65"><a href="http://forum.magicmaman.com/?xtor=EPR-41" border="0" title="Forums"><img style="display: inline;" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/menu_04.jpg" alt="forums" title="forums" width="65" border="0" height="45"></a></td>
    <td width="53"><a href="http://blog.magicmaman.com/" border="0" title="Blogs"><img style="display: inline;" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/menu_05.jpg" alt="Blogs" title="Blogs" width="53" border="0" height="45"></a></td>

    <td width="65"><a href="http://photo.magicmaman.com/" border="0"><img style="display: inline;" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/menu_06.jpg" alt="albums" title="albums" width="65" border="0" height="45"></a></td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#393442" width="184">&nbsp;</td>
    </tr>
    </tbody></table>
    <table class="box-content box-Edito action-new action-state action-edit" width="612" align="center" border="0" cellpadding="0" cellspacing="0"> <tbody><tr>
    <td class="resume-1" style="padding: 10px; font-family: Arial; font-size: 12px;">Magicmaman est heureuse de vous annoncer l'arriv&eacute;e de sa nouvelle page d'accueil et ses rubriques Femme et Sant&eacute;. Bon surf et bonne ann&eacute;e!</td>

    </tr>
    </tbody></table></td>
    </tr>
    <tr>
    <td colspan="3">
    <table class="box-content box-Edito action-new action-state action-edit" width="600" align="center" border="0" cellpadding="0" cellspacing="0">
    <tbody><tr>
    <td class="resume-1" style="padding: 10px; font-family: Arial; font-size: 12px;"></td>
    </tr>

    </tbody></table> </td>
    </tr>
    </tbody></table>
    <table class="box-content action-edit box-OnEnParle action-state action-new action-database action-element-add action-element-remove" style="border: 1px solid rgb(221, 132, 178); background-color: rgb(221, 132, 178);" width="612" align="center" bgcolor="#dd84b2" border="0" cellpadding="0" cellspacing="0" height="197">
    <tbody><tr>
    <td style="border: 10px solid rgb(221, 132, 178);" align="center" bgcolor="#dd84b2">
    <a href="http://www.magicmaman.com/,bailler-dans-le-ventre-de-sa-mere-est-important,2220,1226381.asp?xtor=EPR-41" target="_blank" class="lien-1" style="font-size: 14px; font-weight: bold; color: rgb(58, 54, 68); text-decoration: none;" title=""><img src="http://www.magicmaman.com/mm_edito/upload/7d951993b2frgb600.jpg" alt="On en parle cette semaine" class="img-1" style="border: 1px solid rgb(255, 255, 255);" title="On en parle cette semaine" width="181" border="0" height="180"></a> </td>
    <td>
    <table style="border-style: solid; border-color: rgb(221, 132, 178); border-width: 10px 3px 10px 0px; background-color: rgb(255, 255, 255);" width="394" align="center" bgcolor="#dd84b2" border="0" cellpadding="0" cellspacing="0" height="180">

    <tbody><tr height="180">
    <td class="element-clone-zone element-clone-zone-1" style="border: 1px solid rgb(255, 255, 255); font-family: Arial; color: rgb(221, 132, 178);" height="180">
    &nbsp;<span style="font-size: 18px; font-weight: bold; color: rgb(58, 54, 68);">ON EN PARLE CETTE SEMAINE</span><br><br>
    <span class="element-clone"> &nbsp;<a href="http://www.magicmaman.com/,bailler-dans-le-ventre-de-sa-mere-est-important,2220,1226381.asp?xtor=EPR-41" target="_blank" class="lien-1" style="font-size: 14px; font-weight: bold; color: rgb(58, 54, 68); text-decoration: none;" title="">%u2022 <span class="resume-1">Les bienfaits du b&acirc;illement de B&eacute;b&eacute;...dans votre ventre!</span></a>
    <br>

    </span>
    <span class="element-clone"> &nbsp;<a href="http://www.magicmaman.com/,nouvelle-fermeture-de-maternite,2224,1226398.asp?xtor=EPR-41" target="_blank" class="lien-2" style="font-size: 14px; font-weight: bold; color: rgb(58, 54, 68); text-decoration: none;" title="">%u2022 <span class="resume-2">Une &eacute;ni&egrave;me fermeture de maternit&eacute;. </span></a>
    <br>
    </span>
    <span class="element-clone"> &nbsp;<a href="http://www.magicmaman.com/,celine-dion-enceinte-de-jumeaux-ce-sont-deux-garcons,2226,1226373.asp?xtor=EPR-41" target="_blank" class="lien-3" style="font-size: 14px; font-weight: bold; color: rgb(58, 54, 68); text-decoration: none;" title="">%u2022 <span class="resume-3">C&eacute;line Dion attend...des gar&ccedil;ons !</span></a>

    <br>
    </span>
    </td>
    </tr>
    </tbody></table>
    </td>
    </tr>
    </tbody></table>
    <table width="584" align="center" cellpadding="0" cellspacing="0" height="342">

    <tbody><tr>
    <td style="padding-left: 10px; width: 288px;" width="298" bgcolor="#f9f8f6" height="252">
    <table width="288" align="center" border="0" cellpadding="0" cellspacing="0" height="5">
    <tbody><tr>
    <td style="font-size: 5px;">&nbsp;</td>
    </tr>
    </tbody></table>
    <table width="288" align="center" border="0" cellpadding="0" cellspacing="0">
    <tbody><tr>
    <td style="font-size: 18px; font-weight: bold; color: rgb(58, 54, 68); font-family: Arial;">
    ZOOM SUR
    </td>

    </tr>
    </tbody></table>
    <table width="288" align="center" border="0" cellpadding="0" cellspacing="0" height="5">
    <tbody><tr>
    <td style="font-size: 5px;">&nbsp;

    </td>
    </tr>
    </tbody></table>
    <table class="box-content action-state box-Zoom action-move action-new action-database action-clone" style="border: 1px solid rgb(202, 202, 202); font-size: 18px; font-weight: bold; color: rgb(58, 54, 68); font-family: Arial;" width="288" bgcolor="white" border="0" cellpadding="0" cellspacing="0">

    <tbody><tr>
    <td height="74">
    <a href="http://www.magicmaman.com/,de-l-energie-au-coeur-de-l-hiver,81,5321.asp?xtor=EPR-41" target="_blank" class="lien-1" style="font-size: 14px; font-weight: bold; color: #13ACBE; text-decoration: none;" border="0" title=""><img class="img-1" style="border: 6px solid rgb(255, 255, 255);" src="http://www.magicmaman.com/mm_edito/250/7da61db015be_268.jpg" alt="" title="" width="60" border="0" height="60"></a> </td>
    <td style="font-size: 11px; font-weight: bold; color: rgb(58, 54, 68); font-family: Arial; padding-top: 5px; padding-left: 5px;" valign="middle" height="74">
    <a href="http://www.magicmaman.com/,les-prenoms-cinematographiques,2094,1225629.asp?xtor=EPR-41" target="_blank" class="lien-1" style="font-size: 14px; font-weight: bold; color: rgb(221, 132, 178); text-decoration: none;" title=""><span class="titre-1">Comme au cin&eacute;ma...</span></a><br>
    <span class="resume-1" style="padding-bottom: 5px;">Un pr&eacute;nom qui a marqu&eacute; l'Histoire du cin&eacute;ma pour votre tout petit ? C'est par ici !</span>

    </td>
    </tr>
    </tbody></table>
    <table width="288" border="0" cellpadding="0" cellspacing="0" height="5">
    <tbody><tr>
    <td style="font-size: 5px;">&nbsp;

    </td>
    </tr>
    </tbody></table>

    <table class="box-content action-state box-Zoom action-move action-new action-database action-clone" style="border: 1px solid rgb(202, 202, 202); font-size: 18px; font-weight: bold; color: rgb(58, 54, 68); font-family: Arial;" width="288" bgcolor="white" border="0" cellpadding="0" cellspacing="0">
    <tbody><tr>
    <td height="74"><a href="http://www.magicmaman.com/,de-l-energie-au-coeur-de-l-hiver,81,5321.asp?xtor=EPR-41" target="_blank" class="lien-1" style="font-size: 14px; font-weight: bold; color: #13ACBE; text-decoration: none;" border="0" title=""><img class="img-1" style="border: 6px solid rgb(255, 255, 255);" src="http://www.magicmaman.com/mm_edito/250/7d961ab3310es_048.jpg" alt="" title="" width="60" border="0" height="60"></a></td>
    <td style="font-size: 11px; font-weight: bold; color: rgb(58, 54, 68); font-family: Arial; padding-top: 5px; padding-left: 5px;" valign="middle" height="74">
    <a href="http://www.magicmaman.com/,emotion de la 1ere echographie,364,1135936.asp?xtor=EPR-41" target="_blank" class="lien-1" style="font-size: 14px; font-weight: bold; color: rgb(221, 132, 178); text-decoration: none;" title=""><span class="titre-1">Soldes sp&eacute;cial grossesse</span></a><br>
    <span class="resume-1" style="padding-bottom: 5px;">Le meilleur des prix sold&eacute;s pour la garde-robe de la future maman.</span>
    </td>

    </tr>
    </tbody></table>
    <table width="288" border="0" cellpadding="0" cellspacing="0" height="5">
    <tbody><tr>
    <td style="font-size: 5px;">&nbsp;

    </td>
    </tr>
    </tbody></table>
    <table class="box-content action-state box-Zoom action-move action-new action-database action-clone" style="border: 1px solid rgb(202, 202, 202); font-size: 18px; font-weight: bold; color: rgb(58, 54, 68); font-family: Arial;" width="288" bgcolor="white" border="0" cellpadding="0" cellspacing="0">

    <tbody><tr>
    <td height="74"><a href="http://www.magicmaman.com/,de-l-energie-au-coeur-de-l-hiver,81,5321.asp?xtor=EPR-41" target="_blank" class="lien-1" style="font-size: 14px; font-weight: bold; color: #13ACBE; text-decoration: none;" border="0" title=""><img class="img-1" style="border: 6px solid rgb(255, 255, 255);" src="http://www.magicmaman.com/mm_edito/250/7d9617e2330_7_121.jpg" alt="" title="" width="60" border="0" height="60"></a></td>
    <td style="font-size: 11px; font-weight: bold; color: rgb(58, 54, 68); font-family: Arial; padding-top: 5px; padding-left: 5px;" valign="middle" height="74">
    <a href="http://www.magicmaman.com/,la-trousse-homeopathique-a-emporter-en-vacances,3118,1218426.asp?xtor=EPR-41" target="_blank" class="lien-1" style="font-size: 14px; font-weight: bold; color: rgb(221, 132, 178); text-decoration: none;" title=""><span class="titre-1">La trousse hom&eacute;o des petits bobos</span></a><br>
    <span class="resume-1" style="padding-bottom: 5px;">Cet &eacute;t&eacute;, ayez toujours sur vous votre trousse hom&eacute;opathique! </span> </td>
    </tr>


    </tbody></table>
    <table width="288" border="0" cellpadding="0" cellspacing="0" height="5">
    <tbody><tr>
    <td style="font-size: 5px;">&nbsp;

    </td>
    </tr>
    </tbody></table>
    </td>
    <td style="padding-top: 20px;" valign="middle" width="312" align="center" bgcolor="#f9f8f6">
    <table class="box-content box-Pub action-new action-state" width="284" align="center" border="0" cellpadding="0" cellspacing="0" height="254">
    <tbody><tr>

    <td align="center">
    <a class="lien-1" href="http://www.smartadserver.com/call/cliccommand/2968620/5903/[timestamp]?" border="0"><img class="img-1" src="http://img.magicmaman.com/partenaire/lipikar/dk/mea/250x250.jpg" align="middle" border="0"></a>
    </td>
    </tr>
    </tbody></table>
    </td>
    </tr>
    <tr>
    <td colspan="2" style="padding-left: 10px;" bgcolor="#f9f8f6">

    <table class="box-content action-state action-move action-new action-database action-clone" style="border: 1px solid rgb(202, 202, 202); font-size: 18px; font-weight: bold; color: rgb(58, 54, 68); font-family: Arial;" width="583" bgcolor="white" border="0" cellpadding="0" cellspacing="0">
    <tbody><tr>
    <td height="59">
    <a href="http://www.magicmaman.com/,de-l-energie-au-coeur-de-l-hiver,81,5321.asp?xtor=EPR-41" target="_blank" class="lien-1" style="font-size: 14px; font-weight: bold; color: #13ACBE; text-decoration: none;" border="0" title=""><img src="http://www.famili.fr/data/photos/F0/ventre-femme-enceinte.jpg" alt="" style="border: 6px solid rgb(255, 255, 255);" title="" width="60" border="0" height="60"></a> </td>
    <td style="font-size: 11px; font-weight: bold; color: rgb(58, 54, 68); font-family: Arial; padding-top: 5px; padding-left: 5px;" valign="middle" height="59">
    <a href="http://www.magicmaman.com/concours-ventre-rond/default.asp?rubrique=3030&amp;xtor=EPR-41" target="_blank" class="lien-1" style="font-size: 14px; font-weight: bold; color: rgb(58, 54, 68); text-decoration: none;" title=""><span class="titre-1">CONCOURS VENTRE ROND</span></a><br>
    <br>
    <span class="resume-1" style="padding-bottom: 5px;">Quel sera le plus joli bidon du mois de juillet ? D&eacute;posez votre photo et gagnez une poussette Graco. </span>

    </td>
    </tr>
    </tbody></table>
    <table style="padding-left: 5px;" width="600" align="center" border="0" cellpadding="0" cellspacing="0" height="266">
    <tbody><tr>
    <td width="277" align="center" bgcolor="#f9f8f6" height="266"><table class="box-content box-Pub action-new action-state" style="border: 1px solid rgb(202, 202, 202);" width="254" align="center" border="0" cellpadding="0" cellspacing="0" height="254">
    <tbody><tr>
    <td align="center"><a class="lien-1" href="http://www.magicmaman.com/partenaire/mutuelle-generale/df/e-lamutuellegenerale.asp?xtor=EPR-41" border="0"><img class="img-1" src="http://img.magicmaman.com/partenaire/mutuelle_generale/cl/mea/250x250_brk_b.gif" align="middle" border="0"></a> </td>

    </tr>
    </tbody></table></td>
    <td width="304"><table align="center" border="0" cellpadding="0" cellspacing="0">
    <tbody><tr width="304">
    <td colspan="4"><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/forums_04.gif" alt="Forums : Vous racontez" width="304" border="0" height="55"> </td>
    </tr>
    </tbody></table>
    <table class="box-content action-edit box-racontez action-state action-new action-database" align="center" bgcolor="#fa7cac" border="0" cellpadding="0" cellspacing="0">

    <tbody><tr width="304" style="font-family: Arial;" height="90">
    <td width="12" height="70"><img style="display: block;" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/forums_06.gif" alt="Forums : Vous racontez" width="12" border="0" height="90"></td>
    <td width="24" bgcolor="#fa7cac" height="90">&nbsp;</td>
    <td width="260" align="left" bgcolor="#fa7cac" height="90"><a href="http://forum.magicmaman.com/magicmaman/bien-etre-beaute-grossesse/Fatigue-sommeil/deprime-incomprehensible-sujet-3663047-1.htm?xtor=EPR-41" target="_blank" class="lien-1" style="font-size: 11px; font-weight: bold; color: rgb(58, 54, 68); text-decoration: none; padding-bottom: 5px;" title="">- <font width="260" class="resume-1">D&eacute;prime incompr&eacute;hensible !</font></a><br>
    <a href="http://forum.magicmaman.com/magicmaman/suivi-grossesse/Constipation/grand-connaitre-sexe-sujet-3669924-1.htm?xtor=EPR-41" target="_blank" class="lien-2" style="font-size: 11px; font-weight: bold; color: rgb(58, 54, 68); text-decoration: none; padding-bottom: 5px;" title="">- <font width="260" class="resume-2">Le truc des grands-m&egrave;res pour conna&icirc;tre le sexe. </font></a><br>

    <a href="http://forum.magicmaman.com/magicmaman/prenom-faire-part-naissance/pensez-prenom-caleen-sujet-3671321-1.htm?xtor=EPR-41" target="_blank" class="lien-3" style="font-size: 11px; font-weight: bold; color: rgb(58, 54, 68); text-decoration: none; padding-bottom: 5px;" title="">- <font width="260" class="resume-3">Que pensez-vous du pr&eacute;nom Caleen ?</font> </a> </td>
    <td width="8" height="90"><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/forums_08.gif" alt="Forums : Vous racontez" width="8" height="90"></td>
    </tr>
    </tbody></table>
    <table align="center" border="0" cellpadding="0" cellspacing="0">
    <tbody><tr height="45">

    <td height="45"><a href="http://forum.magicmaman.com/?xtor=EPR-41" border="0"><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/forums_09.gif" alt="Forums : Vous racontez" width="304" border="0" height="45"></a> </td>
    </tr>
    <tr class="box-content box-rubrique action-new action-state">
    <td width="304" bgcolor="#f9f8f6" height="96"><a class="lien-1" href="http://www.magicmaman.com/partenaire/special-fetes-evenements/special-fetes-evenements.asp?xtor=EPR-41" border="0" title=""><img class="img-1" style="display: inline;" src="http://img.magicmaman.com/autopromotion/ef/mea/300x90-vacances-famille.gif" alt="" width="300" border="0" height="90"></a> </td>
    </tr>
    </tbody></table></td>
    </tr>
    </tbody></table>

    <table width="600" align="center" border="0" cellpadding="0" cellspacing="0" height="70">
    <tbody><tr class="box-content box-rubrique action-new action-state">
    <td width="579" align="center" bgcolor="#f9f8f6" height="71"><a class="lien-1" href="[EMV LINK]27[EMV /LINK]" border="0" title=""> <img class="img-1" src="http://img.magicmaman.com/partenaire/bledina/dk/mea/cereales_468x60_251109.gif" alt="" width="468" border="0" height="60"></a> </td>
    </tr>
    </tbody></table>
    <table width="600" align="center" border="0" cellpadding="0" cellspacing="0" height="83">
    <tbody><tr>
    <td><table class="box-content box-Recettes action-new action-state" id="Tableau_" style="font-family: Arial; font-size: 11px;" width="185" border="0" cellpadding="0" cellspacing="0" height="83">

    <tbody><tr>
    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/RECETTE_01.jpg" alt="Magic recettes" width="57" height="23"> </td>
    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/RECETTE_02.jpg" alt="Magic recettes" width="116" height="23"> </td>
    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/RECETTE_03.jpg" alt="Magic recettes" width="12" height="23"> </td>
    </tr>
    <tr>
    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/RECETTE_04.jpg" alt="Magic recettes" width="57" height="50"> </td>

    <td style="color: rgb(102, 102, 102);" width="116" bgcolor="#e4e482" height="50"><a class="lien-1" href="http://www.magic-recettes.com/cuisine/desserts-glaces-creme-glacee-au-caramel-et-beurre-sale/803/17427.asp?xtor=EPR-41" style="font-weight: bold; color: rgb(102, 102, 102); text-decoration: none;" title="Magic recettes"><span class="resume-1">Cr&egrave;me glac&eacute;e au caramel. </span></a> </td>
    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/RECETTE_06.jpg" alt="Magic recettes" width="12" height="50"> </td>
    </tr>
    <tr>
    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/RECETTE_07.jpg" alt="Magic recettes" width="57" height="10"> </td>
    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/RECETTE_08.jpg" alt="Magic recettes" width="116" height="10"> </td>

    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/RECETTE_09.gif" alt="Magic recettes" width="12" height="10"> </td>
    </tr>
    </tbody></table></td>
    <td><table class="box-content box-Maison action-new action-state" id="Tableau_" style="font-family: Arial; font-size: 11px;" width="201" border="0" cellpadding="0" cellspacing="0" height="83">
    <tbody><tr>
    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/MAISON_01.jpg" alt="Magic maison" width="54" height="23"> </td>
    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/MAISON_02.jpg" alt="Magic maison" width="137" height="23"> </td>

    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/MAISON_03.jpg" alt="Magic maison" width="10" height="23"> </td>
    </tr>
    <tr>
    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/MAISON_04.jpg" alt="Magic maison" width="54" height="49"> </td>
    <td style="color: rgb(204, 207, 28);" width="137" bgcolor="#e161ae" height="49"><a class="lien-1" href="http://www.magic-maison.com/maison/tous-les-modeles-couture-la-couverture-de-berceau-molletonee/1028/17823.asp?xtor=EPR-41" style="font-weight: bold; color: rgb(204, 207, 28); text-decoration: none;" title="Magic maison"><span class="resume-1">La couverture de berceau.</span></a> </td>
    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/MAISON_06.jpg" alt="Magic maison" width="10" height="49"> </td>

    </tr>
    <tr>
    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/MAISON_07.jpg" alt="Magic maison" width="54" height="11"> </td>
    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/MAISON_08.jpg" alt="Magic maison" width="137" height="11"> </td>
    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/MAISON_09.jpg" alt="Magic maison" width="10" height="11"> </td>
    </tr>
    </tbody></table></td>

    <td><table class="box-content box-Recre action-new action-state" id="Tableau_" style="font-family: Arial; font-size: 11px;" width="200" border="0" cellpadding="0" cellspacing="0" height="83">
    <tbody><tr>
    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/RECREE_01.jpg" alt="" width="59" height="22"> </td>
    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/RECREE_02.jpg" alt="Magic r&eacute;cr&eacute;" width="131" height="22"> </td>
    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/RECREE_03.jpg" alt="Magic r&eacute;cr&eacute;" width="10" height="22"> </td>
    </tr>
    <tr>

    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/RECREE_04.jpg" alt="Magic r&eacute;cr&eacute;" width="59" height="51"> </td>
    <td style="color: rgb(255, 255, 255);" width="131" bgcolor="#23819b" height="51"><a class="lien-1" href="http://www.magic-recre.com/enfant,coloriage-la-plage,swf1420,20814.asp?xtor=EPR-41" style="font-weight: bold; color: rgb(255, 255, 255); text-decoration: none;" title="Magic r&eacute;cr&eacute;"><span class="resume-1">Coloriage : la plage.</span></a> </td>
    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/RECREE_06.jpg" alt="Magic r&eacute;cr&eacute;" width="10" height="51"> </td>
    </tr>
    <tr>
    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/RECREE_07.jpg" alt="Magic r&eacute;cr&eacute;" width="59" height="10"> </td>

    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/RECREE_08.jpg" alt="Magic r&eacute;cr&eacute;" width="131" height="10"> </td>
    <td><img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/RECREE_09.jpg" alt="Magic r&eacute;cr&eacute;" width="10" height="10"> </td>
    </tr>
    </tbody></table></td>
    </tr>
    </tbody></table></td>
    </tr>

    </tbody></table> </td>

    </tr>
    </tbody></table>
    <table width="600" align="center" border="0" cellpadding="0" cellspacing="0">
    <tbody><tr>
    <td style="font-family: Arial; font-size: 10px;" align="center">Vous recevez cet e-mail en tant qu'inscrite &agrave; la newsletter grossesse de Magicmaman<br>
    &lt;%@ include view="UnsubMMGrossesse" %&gt;</td>
    </tr>

    </tbody></table>




    </body></html><div class="scripts-newsletter">
    <script>var app_path = 'http://tools.mc2m.fr/WebServices/newsletter';</script>
    <style>body{margin-top:39px;}</style>
    <link rel="shortcut icon" href="img/favicon.gif" type="image/x-icon" />
    <script src="scripts/mootools.v1.2.js" type="text/javascript"></script>
    <script src="scripts/inlineEdit.js" type="text/javascript"></script>

    <script src="scripts/box.js" type="text/javascript"></script>
    <script src="scripts/core.js" type="text/javascript"></script>
    <script src="scripts/nicEdit.js" type="text/javascript"></script>
    <script type="text/javascript">


    window.addEvent('domready',function(){

    new informations({couleur_info:'#F2D000', couleur_edit:'#CF750C', couleur_form:'#FE24AC', site:'mm', name:'mmGrossesse', archive:'newsletter_00000000_mm_mmGrossesse-04', code_xtor:'EPR-41'});

    //On rajoute le code xtor à la fin de chaque url de la NL.
    if('EPR-41' != '') {
    $$('a').each(function(el){
    var url = el.href;
    if((url != "#") && (url != "") &&
    !(url.contains ("&&&")) &&
    !(url.contains("mailto:")) &&
    !(url.contains("xtor=")) &&
    (
    (url.contains("www.marieclaire.fr")) ||
    (url.contains("www.marieclairemaison.com")) ||
    (url.contains("www.cosmopolitan.fr")) ||
    (url.contains("www.famili.fr")) ||
    (url.contains("www.larvf.com")) ||
    (url.contains("www.cuisineetvinsdefrance.com")) ||
    (url.contains("www.larvf.com")) ||
    (url.contains("www.envy.fr")) ||
    (url.contains("forum.magicmaman.com")) ||
    (url.contains("www.magicmaman.com")) ||
    (url.contains("www.magic-maison.com")) ||
    (url.contains("www.magic-recettes.com")) ||
    (url.contains("www.magic-recre.com")) ||
    (url.contains("www.magicmaman.be")) ||
    (url.contains("www.magicmama.be")) ||
    (url.contains("www.magazine-avantages.fr"))
    )
    ) {

    // $$('a.tipz').each(function(element,index) {
    // var truc = element.get('title')
    // alert(truc);

    if (url.contains('?')) {
    el.href = url + '&xtor=EPR-41';
    }
    else {
    el.href = url + '?xtor=EPR-41';
    }
    }
    });
    }
    });
    </script>
    </div>

  5. #5
    Membre averti Avatar de Nheo_
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2011
    Messages
    323
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2011
    Messages : 323
    Points : 416
    Points
    416
    Par défaut
    N'oublie pas, .
    Je me suis mal exprimé, donnes le script complet, pas le code source.

  6. #6
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mars 2010
    Messages
    11
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2010
    Messages : 11
    Points : 7
    Points
    7
    Par défaut
    Citation Envoyé par Nheo_ Voir le message
    N'oublie pas, .
    Je me suis mal exprimé, donnes le script complet, pas le code source.
    Oui pardon, j'ai pas pensé à mettre les balises.

    Voici le script complet :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    <?php
     
    require('config/config.php');
     
    header("Pragma: no-cache");
    header("Cache-Control: max-age=1, maxage=1, no-cache, must-revalidate" );
    session_cache_limiter("nocache"); 
     
    $lc_archives = "";
    if(isset($_GET['archive']) && !empty($_GET['archive']))
    {
    	$lc_archives = $_GET['archive'];
    	$path = "$pathTemplates/{$_GET['site']}/{$_GET['name']}/archives/".$_GET['archive'].".html";
    }
    else
    {
    	$path = "templates/{$_GET['site']}/{$_GET['name']}/newsletter.html";	
    }	
    if(!isset($_GET['view']) && !isset($_GET['viewWithoutTags']))
    {
    	require($path);	
     
    	$lc_xml = simplexml_load_file('config/newsletters.xml');
    	$newsletter = $lc_xml->xpath("//newsletter[@site='{$_GET['site']}'][@name='{$_GET['name']}']");
    	$couleur_info = $newsletter[0]['couleur_info'];
    	$couleur_edit = $newsletter[0]['couleur_edit'];
    	$couleur_form = $newsletter[0]['couleur_form'];
    	$code_xtor = $newsletter[0]['xtor'];
    	?>
    <div class="scripts-newsletter">
    	<script>var app_path = '<?= $url_app ?>';</script> 
    	<style>body{margin-top:39px;}</style>
    	<link rel="shortcut icon" href="img/favicon.gif" type="image/x-icon" />
     	<script src="scripts/mootools.v1.2.js" type="text/javascript"></script>
    	<script src="scripts/inlineEdit.js" type="text/javascript"></script>
    	<script src="scripts/box.js" type="text/javascript"></script>
    	<script src="scripts/core.js" type="text/javascript"></script>
    	<script src="scripts/nicEdit.js" type="text/javascript"></script>
    	<script type="text/javascript">
     
     
    	window.addEvent('domready',function(){
     
    		new informations({couleur_info:'<?=$couleur_info ?>', couleur_edit:'<?=$couleur_edit ?>', couleur_form:'<?=$couleur_form ?>', site:'<?=$_GET['site'] ?>', name:'<?=$_GET['name'] ?>', archive:'<?=$lc_archives ?>', code_xtor:'<?=$code_xtor ?>'}); 
     
    		//On rajoute le code xtor à la fin de chaque url de la NL.
    		if('<?=$code_xtor ?>' != '') {
    			$$('a').each(function(el){
    				var url = el.href;
    				if((url != "#") && (url != "") &&
    				 	!(url.contains ("&&&")) && 
    				 	!(url.contains("mailto:")) &&
    				  	!(url.contains("xtor=")) &&
    						(
    							(url.contains("www.marieclaire.fr")) ||
    							(url.contains("www.marieclairemaison.com")) ||
    							(url.contains("www.cosmopolitan.fr")) ||
    							(url.contains("www.famili.fr")) ||
    							(url.contains("www.larvf.com")) ||
    							(url.contains("www.cuisineetvinsdefrance.com")) ||
    							(url.contains("www.larvf.com")) ||
    							(url.contains("www.envy.fr")) ||
    							(url.contains("forum.magicmaman.com")) ||
    							(url.contains("www.magicmaman.com")) ||	
    							(url.contains("www.magic-maison.com")) ||
    							(url.contains("www.magic-recettes.com")) ||
    							(url.contains("www.magic-recre.com")) ||
    							(url.contains("www.magicmaman.be")) ||
    							(url.contains("www.magicmama.be")) ||
    							(url.contains("www.magazine-avantages.fr"))
    						) 	
    				  	 ) {
     
    					 // $$('a.tipz').each(function(element,index) {
    					 // var truc = element.get('title')
    // alert(truc);
     
    					if (url.contains('?')) {
    						el.href = url + '&xtor=<?=$code_xtor ?>';
    					}
    					else {
    						el.href = url + '?xtor=<?=$code_xtor ?>';
    					}
    				}
    			});
    		}
    	});
    	</script>
    </div>
     
    <? 
    } 
    else if (isset($_GET['view']))
    {
    	ob_start();
    	require($path);	
    	$lc_contents = ob_get_contents();
    	ob_end_clean();
    	// on supprime les elements cachés
    	$lc_contents = preg_replace("|(<!--[^-->])(.*)([^//]-->)|Usi", "", $lc_contents);
    	echo "[EMV HTMLPART]\n".$lc_contents;
    }
     
     
    if(isset($_GET['viewWithoutTags']))
    {
    	ob_start();
    	require($path);	
    	$lc_contents = ob_get_contents();
    	ob_end_clean();
     
     
    	// on supprime les elements cachés
    	$lc_contents = preg_replace("|(<!--[^-->])(.*)([^//]-->)|Usi", "", $lc_contents);
    	traitement($lc_contents);
    	$lc_contents = file_get_contents("viewNewsletter.php");
    	echo $lc_contents;
    }
     
     function traitement($lc_contents){
     
    	//suppression des balises inutiles pour l'envoi de newsletters
    	$lc_contents=str_replace ('<tbody>','',  $lc_contents);
    	$lc_contents=str_replace ('</tbody>','',  $lc_contents);
    	$lc_contents=preg_replace('#class="(.*?)"#','',$lc_contents);
    	$lc_contents=str_replace ('%3C','<',  $lc_contents);	 
    	$lc_contents=str_replace ('%3E','>',  $lc_contents);	 	
     
    	$lc_contents=preg_replace('/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/','',$lc_contents);
    	$lc_contents=preg_replace('/(?:<noscript.*?>)((\n|\r|.)*?)(?:<\/noscript>)/','',$lc_contents);
     
    	$lc_contents=preg_replace('/(?:class=".*?>)((\n|\r|a-z|A-Z|0-9)*?)(?:e")/','',$lc_contents);	
     
    	  if(preg_match('#title="Magic r&eacute;cr&eacute;"#',$lc_contents))	{
    		$lc_contents=preg_replace('#href="http://www.magic-maison.com(.*?)"#','#href="(.*?)xtor=EPR-27(.*?)title="Magic r&eacute;cr&eacute;"#',$lc_contents);
    	  }
     
     
    	//suppression de 1 à 3 <table display: none ...   pas réussi à automatiser à l'infini (le cas ne doit pas exister de toute façon)
    	  if(preg_match('#<table(.*?)display: none;"#',$lc_contents))	{
    			if(preg_match('#<table(.*?)display: none;"(.*?)<table(.*?)display: none;"(.*?)</table>(.*?)</table>#',$lc_contents))	{
    					if(preg_match('#<table(.*?)display: none;"(.*?)<table(.*?)display: none;"(.*?)<table(.*?)display: none;"(.*?)</table>(.*?)</table>(.*?)</table>#',$lc_contents))	{
    						$lc_contents=preg_replace('#<table(.*?)display: none;"(.*?)<table(.*?)display: none;"(.*?)<table(.*?)display: none;"(.*?)</table>(.*?)</table>(.*?)</table>#','',$lc_contents);
    					}
    					else	{
     
    						$lc_contents=preg_replace('#<table(.*?)display: none;"(.*?)<table(.*?)display: none;"(.*?)</table>(.*?)</table>#','',$lc_contents);
    					}
    			}
    			else	{
    				$lc_contents=preg_replace('#<table(.*?)display: none;"(.*?)</table>#','',$lc_contents);
    			}
    	 }		
    	$file=fopen("viewNewsletter.php","w");
    	//on écrit les données dans le fichier texte
    	fwrite($file,trim($lc_contents));
    	//procédure permettant de supprimer les lignes vides dans le fichier
    	$content = file_get_contents("viewNewsletter.php");
    	$new_content = "";
    	$lines = explode(chr(10), $content);
    	foreach ($lines as $line) {
    		if (strlen(trim($line)) > 0) {
    			$new_content .= $line . chr(10);
    		}
    	}
    	//on supprime le fichier qui contient les lignes vides
    	unlink("viewNewsletter.php");
    	//et on réinsère le nouveau code dans le fichier vidé
    	$file=fopen("viewNewsletter.php","w");	
    	fwrite($file,trim($new_content));
     }
     
    ?>


    Les xtor sont générés avec un script js mootools. En fait chaque page générée à un xtor particulier qui est appelé dans toute la page, moi je veux juste créer un outil capable de modifier des xtor particuliers sur le code source d'une page.
    J'ai une nouvelle piste, si le lien du href est "www.magicmaison.com" je sais qu'il faut mettre xtor à 27.
    Donc
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    href="http://www.magic-maison.com/maison/tous-les-modeles-couture-la-couverture-de-berceau-molletonee/1028/17823.asp?xtor=EPR-41"
    devient
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    href="http://www.magic-maison.com/maison/tous-les-modeles-couture-la-couverture-de-berceau-molletonee/1028/17823.asp?xtor=EPR-27"

  7. #7
    Membre averti Avatar de Nheo_
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2011
    Messages
    323
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2011
    Messages : 323
    Points : 416
    Points
    416
    Par défaut
    C'est normal que ça remplace dans tout le document.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    if(preg_match('#title="Magic recettes"#',$lc_contents))
    {
         $lc_contents=str_replace ('EPR-36','EPR-41',  $lc_contents);
    }

    En gros : si TOUT ton texte contient une fois "Magic recettes", tu remplace alors TOUS les EPR-36 pas 41 puisque tu fais le traitement sur $lc_contents.

  8. #8
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mars 2010
    Messages
    11
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2010
    Messages : 11
    Points : 7
    Points
    7
    Par défaut
    Citation Envoyé par Nheo_ Voir le message
    C'est normal que ça remplace dans tout le document.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    if(preg_match('#title="Magic recettes"#',$lc_contents))
    {
         $lc_contents=str_replace ('EPR-36','EPR-41',  $lc_contents);
    }

    En gros : si TOUT ton texte contient une fois "Magic recettes", tu remplace alors TOUS les EPR-36 pas 41 puisque tu fais le traitement sur $lc_contents.
    Oui je sais. Et justement j'aimerais avoir une solution pour remplacer seulement le xtor de la ligne qui commence par href="http://www.magic-maison ...
    Donc est ce qu'il y a une solution avec des regex ?

  9. #9
    Membre averti Avatar de Nheo_
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2011
    Messages
    323
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2011
    Messages : 323
    Points : 416
    Points
    416
    Par défaut
    Ceci devrait marcher :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    preg_replace("#EPR-41(.+Magic recettes)#U","EPR-10 $1",$lc_contents).
    Remplace EPR-41 par EPR-10 pour la ligne Magic recettes.

  10. #10
    Expert éminent
    Avatar de transgohan
    Homme Profil pro
    Développeur Temps réel Embarqué
    Inscrit en
    Janvier 2011
    Messages
    3 146
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Maine et Loire (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur Temps réel Embarqué

    Informations forums :
    Inscription : Janvier 2011
    Messages : 3 146
    Points : 9 386
    Points
    9 386
    Par défaut
    Et ça remplace aussi le lien suivant sans toucher au lien du milieu s'il n'a pas Magic recettes. ^^

    Et pire que cela, le terme Magic Recette est utilisé en alt sur certaines images.

  11. #11
    Membre averti Avatar de Nheo_
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2011
    Messages
    323
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2011
    Messages : 323
    Points : 416
    Points
    416
    Par défaut
    Je ne comprends pas ce que tu veux dire transgohan :
    J'ai testé sur :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    <a href="http://www.magic-recettes.com/cuisine/desserts-glaces-creme-glacee-au-caramel-et-beurre-sale/803/17427.asp?xtor=EPR-41" style="font-weight: bold; color: rgb(102, 102, 102); text-decoration: none;" title="Magic recettes">
    <a href="http://www.magic-recettes.com/cuisine/desserts-glaces-creme-glacee-au-caramel-et-beurre-sale/803/17427.asp?xtor=EPR-41" style="font-weight: bold; color: rgb(102, 102, 102); text-decoration: none;" title="Magic recettes">
    <img style="display:block" src="http://img.magicmaman.com/mailing/magicmaman/dk/infolettres/grossesse/RECETTE_01.jpg" alt="Magic recettes" width="57" height="23">'
    Ca me remplace bien les deux EPR, et la balise img n'est pas modifiée.

  12. #12
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mars 2010
    Messages
    11
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2010
    Messages : 11
    Points : 7
    Points
    7
    Par défaut
    T'es sur que ça marche Nheo ?

    J'ai testé ton expression régulière sur les 3 lignes qui t'ont servies de test mais la valeur des xtor n'a pas changée ... Merci de ton aide mais je désespère un peu

  13. #13
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mars 2010
    Messages
    11
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2010
    Messages : 11
    Points : 7
    Points
    7
    Par défaut
    Ah si ça fonctionne, au temps pour moi ...
    Merci beaucoup !

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Problème pour trouver les données commune dans une requête
    Par Winterrage dans le forum Langage SQL
    Réponses: 3
    Dernier message: 08/02/2008, 10h14
  2. [VB.NET][WebServices] Problème pour trouver une Assembly
    Par sleeloo dans le forum Services Web
    Réponses: 3
    Dernier message: 19/11/2006, 12h45
  3. Problème pour trouver les MAX
    Par Erakis dans le forum Requêtes
    Réponses: 5
    Dernier message: 02/05/2006, 19h58
  4. [EJB]JBoss et JNDI, problème pour trouver mes EJB
    Par shingo dans le forum Wildfly/JBoss
    Réponses: 3
    Dernier message: 31/12/2005, 15h14
  5. Réponses: 3
    Dernier message: 24/11/2005, 09h44

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo