How to split a string at the first `/` (slash) and surround part of it in a ``?

前端 未结 7 1758
独厮守ぢ
独厮守ぢ 2020-11-28 01:28

I want to format this date:

23/05/2013
.

First I want to split the string at the first / and have the res

7条回答
  •  我在风中等你
    2020-11-28 02:05

    Try this

    $("div#date").text().trim().replace(/\W/g,'/');
    

    DEMO

    Look a regular expression http://regexone.com/lesson/misc_meta_characters

    enjoy us ;-)

提交回复
热议问题