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

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -