javascript - Remove commas from the content -


i want change date format removing commas.

i cannot access html content var d = "friday, 20 november, 2015, 2015, sunday, 22 november, 2015" var res = d.replace(/,(?=\s+\d+)/g, ""); document.write(res);

  • when

  • friday, 20 november, 2015 - sunday, 22 november, 2015
    09:00 - 17:00
    gmt time

  •                         <ul class="icons">                          <li>                             <a id="lnkaddcal" href="javascript:void(1);" style="text-decoration: none">                                 <img src="/g/images/details-calendar-large.png" title="add calendar" alt="add calendar"><span style="display:block">add calendar</span>                             </a>                             <p id="tdcal" style="position:relative;display:none;">                                                             </p>                         </li>                          </ul>                  <input name="planner" value="" type="hidden">                 <input name="title" value="" type="hidden">                 <input name="start" value="" type="hidden">                 <input name="end" value="" type="hidden">                 <input name="loc" value="" type="hidden">                 <input name="desc" value="" type="hidden">                 <input name="createdate" value="" type="hidden">         </div> 

    i have no idea how can without modifying content page.

    please help.

    one way can use regex below. here jsfiddle demonstrate https://jsfiddle.net/8srprlxu/

    var str= "thursday, 19 november, 2015 , saturday, 21 november, 2015 "; res = str.replace(/[, ]+/g, " "); res = res.replace("2015", "2015,"); 

    Comments

    Popular posts from this blog

    Java 3D LWJGL collision -

    spring - SubProtocolWebSocketHandler - No handlers -

    methods - python can't use function in submodule -