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 -

c# - How do I get the Nth largest element from a list with duplicates, using LINQ? -

jsp - "Sending a redirect is forbidden after the response has been committed" in sendRedirect -