javascript - Extract date part from a string -
is there way extract date part string if other text not fixed:
input: "6/27/2014 - today"
expected: "6/27/2014"
try following snippet:
var input = "6/27/2014 - today"; var expected = input.match(/\d{1,2}\/\d{1,2}\/\d{4}/)[0]; console.log(expected);
Comments
Post a Comment