I'm trying to fetch all DateTime fields using JS/Jquery.
Currently I'm trying it with Regex, but failing miserably.
INPUT:
12345 User Name 9/10/2018 11:39:37 AM Valid Entry Place1
12345 User Name 9/10/2018 12:48:43 PM Valid Exit Outside Place1
12345 User Name 9/10/2018 1:00:44 PM Valid Entry Place1
12345 User Name 9/10/2018 2:17:01 PM Valid Exit Outside Place1
12345 User Name 9/10/2018 3:23:36 PM Valid Entry Place1
12345 User Name 9/10/2018 3:25:56 PM Valid Entry Place1
12345 User Name 9/10/2018 6:06:25 PM Valid Exit Outside Place1
12345 User Name 9/10/2018 6:07:55 PM Valid Entry LC
12345 User Name 9/10/2018 6:28:19 PM Valid Exit Outside LC
12345 User Name 9/10/2018 6:30:06 PM Valid Entry Place1
EXPECTED OUTPUT:
9/10/2018 11:39:37 AM
9/10/2018 12:48:43 PM
9/10/2018 1:00:44 PM
9/10/2018 2:17:01 PM
9/10/2018 3:23:36 PM
9/10/2018 3:25:56 PM
9/10/2018 6:06:25 PM
9/10/2018 6:07:55 PM
9/10/2018 6:28:19 PM
9/10/2018 6:30:06 PM
CURRENT LOGIC:
function myFunction() {
var str = document.getElementById("demo").innerHTML;
var txtIdAndName = str.replace(/[0-9]*\s[a-z,\s*]*/ig,"");
var txtStatusAndPlace = txtIdAndName.replace(/[AM,PM]+\s[a-z,\s*]*/ig,"<br/>");
document.getElementById("demo").innerHTML = txtStatusAndPlace;
}
Please do let me know if any more info is needed form my end.
Can use any Logic or method to achieve the task.
Thanks in advance