moi65
5/21/2017 - 8:07 PM

JS Bin // source https://jsbin.com/jomusij

JS Bin

// source https://jsbin.com/jomusij

console.clear();
var str = '“2nd Saturday of every other month, 10:00 am-12:00 pm,” into a sequence of items in machine format?\n> Hello, I am Eliza.\n> How are you today.. What would you like to discuss?\n> I understand.\n05 Mar 2014 1:16 PM\n06-16-2014\n1, 14, 20 of each month\n14,565 total views, 176 views today\n2 Apr – Wed 10:00AM-10:45AM\n2 avril - Mer 10h00-10: 45am\n2 months ago\n2012-Jul\n2013-09-10 · Updated to Bootstrap 3.0.0 stable.\n25 Apr 2014\n2e samedi de chaque deux mois, 10h00-12: 12 heures\n2nd Saturday of every other month, 10:00 am-12:00 pm\n455 lines (353 sloc) 17.355 kb\n7,2,0\n9th Jul 2013\nAbout three years ago in 2011\nApril 15th, 2008\nAt 7 o\'clock in the morning.\nAt 7.15 o\'clock in the morning.\nAt 8 o\'clock in the morning.\nAt 9 o\'clock in the morning.\nAUG 4TH, 2013\ndisplays: 06-16-2014 16:00\nDuration: 6:12\neach thurs until next month\nEn semaine de 8h30 à 4 h 30\nevery fourth of the month from jan 1 2010 to dec 25th 2020\nevery fri, wed\nevery fri; every end of month\nevery monday\nEvery Tuesday of the month from 10:00-11:00 a.m\nFebruary 4, 2013\nHuman due dates\nin an hour\nInvalid date\nJeu 11/15/07 - ven, 11/04/08\nJul-8-14\nJuly 24th, 2014\nJuly 31st 2014, 11:05:55 pm\nJuly 8-14\nLa version de JQuery est la 2.1.1\nLast modified\nLet’s start with the benefits of object-oriented programming (OOP) support, offered by MooTools.\nMar, 01/04/08\nMarch 8, 2013\nMAY 05, 2014\nMay 7th, 2014\nMonday, December 2nd, 2013 11:28 -- http://www.1stwebdesigner.com/css/psd-to-html-css-tutorials/\nNatural language parsing of dates and recurring events\nnext tuesday\nOCT. 25, 2013, 11:28 AM\non weekdays\nonce a year on the fourth thursday in november\nPlease schedule the meeting for every other tuesday at noon\nposté 15 mai 2014 13:30:53\nPosted on August 04, 2006\nPosted on March 13, 2014 by Sarah · 0 comments\nPosted: 12-Mar-2014\nPOSTED: DEC 15, 2013 11:18 AM EST\nPOSTED: DEC 15, 2013 6:23 PM EST\nQuickly write due dates using normal language, such as “monday at 2pm”.\nRecurring events\nSam., avril 05 09h00 Inscription / Aperçu, 10:00 Vente aux enchères en direct\nSat., Apr. 05, 9:00 AM Registration/Preview, 10:00 AM Live Auction\nseek an information.\nSeptember 11th, 2008\nSeptember 25, 2013\nSet an alarm for next tuesday at 11pm\nThu, 11/15/07 – Fri, 4/11/08\ntomorrow\nTotal Followers 176,741\nTous les mardis du mois de 10h00-11h00\ntrue\nTue, 4/1/08\ntuesdays and thursdays at 3:15\nubiflow on 24 Sep 2014 Petites corrections\nUpdate 2007-02-07\nWed. the 14th of May. 2014\nWeekdays 8:30am-4:30pm\nWhen _____ , I want to _____ , so I can _____ .\nWhere is part 5? Are there going to be 10 of these? Looking forward to more.\nyes';

str = '“2nd Saturday of every other month, 10:00 am-12:00 pm,” into a sequence of items in machine format?\n> Hello, I am Eliza.\n> How are you today.. What would you like to discuss?\n> I understand.\n05 Mar 2014 1:16 PM\n06-16-2014\n1, 14, 20 of each month\n14,565 total views, 176 views today\n2 Apr – Wed 10:00AM-10:45AM\n2 avril - Mer 10h00-10: 45am\n2 months ago\n2012-Jul\n2013-09-10 · Updated to Bootstrap 3.0.0 stable.\n';


var re = /\d+/gi; 
var m;
var c = 0; 
while ((m = re.exec(str)) !== null) {
    if (m.index === re.lastIndex) {
        re.lastIndex++;
    }
    // View your result using the m-variable.
    // eg m[0] etc.
    console.log(c, m[0]); 
  c++;
}

console.log("== 2 ============================================");

var text = str;
text.split(/\s+/).forEach(function(word) {
	console.log(word)	;
		});

console.log("== 3 ============================================");
text.split(/\W+/).forEach(function(word) {
	console.log(word)	;
		});

console.log("== 4 ============================================");

var m;
 c=0;
var re = /\w+/ig; 
while ((m = re.exec(str)) !== null) {
    if (m.index === re.lastIndex) {
        re.lastIndex++;
    }
    // View your result using the m-variable.
     console.log(c, m[0], m.index); 
 
   $("#results").append('<tr><td>' + '' + '</td><td>' +  m[0] + '</td></tr>');
  c++;
}
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
    <div id='results'></div>
 <script src="https://code.jquery.com/jquery-2.1.3.min.js" integrity="sha256-ivk71nXhz9nsyFDoYoGf2sbjrR9ddh+XDkCcfZxjvcM=" crossorigin="anonymous"></script>
<script id="jsbin-javascript">
console.clear();
var str = '“2nd Saturday of every other month, 10:00 am-12:00 pm,” into a sequence of items in machine format?\n> Hello, I am Eliza.\n> How are you today.. What would you like to discuss?\n> I understand.\n05 Mar 2014 1:16 PM\n06-16-2014\n1, 14, 20 of each month\n14,565 total views, 176 views today\n2 Apr – Wed 10:00AM-10:45AM\n2 avril - Mer 10h00-10: 45am\n2 months ago\n2012-Jul\n2013-09-10 · Updated to Bootstrap 3.0.0 stable.\n25 Apr 2014\n2e samedi de chaque deux mois, 10h00-12: 12 heures\n2nd Saturday of every other month, 10:00 am-12:00 pm\n455 lines (353 sloc) 17.355 kb\n7,2,0\n9th Jul 2013\nAbout three years ago in 2011\nApril 15th, 2008\nAt 7 o\'clock in the morning.\nAt 7.15 o\'clock in the morning.\nAt 8 o\'clock in the morning.\nAt 9 o\'clock in the morning.\nAUG 4TH, 2013\ndisplays: 06-16-2014 16:00\nDuration: 6:12\neach thurs until next month\nEn semaine de 8h30 à 4 h 30\nevery fourth of the month from jan 1 2010 to dec 25th 2020\nevery fri, wed\nevery fri; every end of month\nevery monday\nEvery Tuesday of the month from 10:00-11:00 a.m\nFebruary 4, 2013\nHuman due dates\nin an hour\nInvalid date\nJeu 11/15/07 - ven, 11/04/08\nJul-8-14\nJuly 24th, 2014\nJuly 31st 2014, 11:05:55 pm\nJuly 8-14\nLa version de JQuery est la 2.1.1\nLast modified\nLet’s start with the benefits of object-oriented programming (OOP) support, offered by MooTools.\nMar, 01/04/08\nMarch 8, 2013\nMAY 05, 2014\nMay 7th, 2014\nMonday, December 2nd, 2013 11:28 -- http://www.1stwebdesigner.com/css/psd-to-html-css-tutorials/\nNatural language parsing of dates and recurring events\nnext tuesday\nOCT. 25, 2013, 11:28 AM\non weekdays\nonce a year on the fourth thursday in november\nPlease schedule the meeting for every other tuesday at noon\nposté 15 mai 2014 13:30:53\nPosted on August 04, 2006\nPosted on March 13, 2014 by Sarah · 0 comments\nPosted: 12-Mar-2014\nPOSTED: DEC 15, 2013 11:18 AM EST\nPOSTED: DEC 15, 2013 6:23 PM EST\nQuickly write due dates using normal language, such as “monday at 2pm”.\nRecurring events\nSam., avril 05 09h00 Inscription / Aperçu, 10:00 Vente aux enchères en direct\nSat., Apr. 05, 9:00 AM Registration/Preview, 10:00 AM Live Auction\nseek an information.\nSeptember 11th, 2008\nSeptember 25, 2013\nSet an alarm for next tuesday at 11pm\nThu, 11/15/07 – Fri, 4/11/08\ntomorrow\nTotal Followers 176,741\nTous les mardis du mois de 10h00-11h00\ntrue\nTue, 4/1/08\ntuesdays and thursdays at 3:15\nubiflow on 24 Sep 2014 Petites corrections\nUpdate 2007-02-07\nWed. the 14th of May. 2014\nWeekdays 8:30am-4:30pm\nWhen _____ , I want to _____ , so I can _____ .\nWhere is part 5? Are there going to be 10 of these? Looking forward to more.\nyes';

str = '“2nd Saturday of every other month, 10:00 am-12:00 pm,” into a sequence of items in machine format?\n> Hello, I am Eliza.\n> How are you today.. What would you like to discuss?\n> I understand.\n05 Mar 2014 1:16 PM\n06-16-2014\n1, 14, 20 of each month\n14,565 total views, 176 views today\n2 Apr – Wed 10:00AM-10:45AM\n2 avril - Mer 10h00-10: 45am\n2 months ago\n2012-Jul\n2013-09-10 · Updated to Bootstrap 3.0.0 stable.\n';


var re = /\d+/gi; 
var m;
var c = 0; 
while ((m = re.exec(str)) !== null) {
    if (m.index === re.lastIndex) {
        re.lastIndex++;
    }
    // View your result using the m-variable.
    // eg m[0] etc.
    console.log(c, m[0]); 
  c++;
}

console.log("== 2 ============================================");

var text = str;
text.split(/\s+/).forEach(function(word) {
	console.log(word)	;
		});

console.log("== 3 ============================================");
text.split(/\W+/).forEach(function(word) {
	console.log(word)	;
		});

console.log("== 4 ============================================");

var m;
 c=0;
var re = /\w+/ig; 
while ((m = re.exec(str)) !== null) {
    if (m.index === re.lastIndex) {
        re.lastIndex++;
    }
    // View your result using the m-variable.
     console.log(c, m[0], m.index); 
 
   $("#results").append('<tr><td>' + '' + '</td><td>' +  m[0] + '</td></tr>');
  c++;
}
</script>



<script id="jsbin-source-javascript" type="text/javascript">console.clear();
var str = '“2nd Saturday of every other month, 10:00 am-12:00 pm,” into a sequence of items in machine format?\n> Hello, I am Eliza.\n> How are you today.. What would you like to discuss?\n> I understand.\n05 Mar 2014 1:16 PM\n06-16-2014\n1, 14, 20 of each month\n14,565 total views, 176 views today\n2 Apr – Wed 10:00AM-10:45AM\n2 avril - Mer 10h00-10: 45am\n2 months ago\n2012-Jul\n2013-09-10 · Updated to Bootstrap 3.0.0 stable.\n25 Apr 2014\n2e samedi de chaque deux mois, 10h00-12: 12 heures\n2nd Saturday of every other month, 10:00 am-12:00 pm\n455 lines (353 sloc) 17.355 kb\n7,2,0\n9th Jul 2013\nAbout three years ago in 2011\nApril 15th, 2008\nAt 7 o\'clock in the morning.\nAt 7.15 o\'clock in the morning.\nAt 8 o\'clock in the morning.\nAt 9 o\'clock in the morning.\nAUG 4TH, 2013\ndisplays: 06-16-2014 16:00\nDuration: 6:12\neach thurs until next month\nEn semaine de 8h30 à 4 h 30\nevery fourth of the month from jan 1 2010 to dec 25th 2020\nevery fri, wed\nevery fri; every end of month\nevery monday\nEvery Tuesday of the month from 10:00-11:00 a.m\nFebruary 4, 2013\nHuman due dates\nin an hour\nInvalid date\nJeu 11/15/07 - ven, 11/04/08\nJul-8-14\nJuly 24th, 2014\nJuly 31st 2014, 11:05:55 pm\nJuly 8-14\nLa version de JQuery est la 2.1.1\nLast modified\nLet’s start with the benefits of object-oriented programming (OOP) support, offered by MooTools.\nMar, 01/04/08\nMarch 8, 2013\nMAY 05, 2014\nMay 7th, 2014\nMonday, December 2nd, 2013 11:28 -- http://www.1stwebdesigner.com/css/psd-to-html-css-tutorials/\nNatural language parsing of dates and recurring events\nnext tuesday\nOCT. 25, 2013, 11:28 AM\non weekdays\nonce a year on the fourth thursday in november\nPlease schedule the meeting for every other tuesday at noon\nposté 15 mai 2014 13:30:53\nPosted on August 04, 2006\nPosted on March 13, 2014 by Sarah · 0 comments\nPosted: 12-Mar-2014\nPOSTED: DEC 15, 2013 11:18 AM EST\nPOSTED: DEC 15, 2013 6:23 PM EST\nQuickly write due dates using normal language, such as “monday at 2pm”.\nRecurring events\nSam., avril 05 09h00 Inscription / Aperçu, 10:00 Vente aux enchères en direct\nSat., Apr. 05, 9:00 AM Registration/Preview, 10:00 AM Live Auction\nseek an information.\nSeptember 11th, 2008\nSeptember 25, 2013\nSet an alarm for next tuesday at 11pm\nThu, 11/15/07 – Fri, 4/11/08\ntomorrow\nTotal Followers 176,741\nTous les mardis du mois de 10h00-11h00\ntrue\nTue, 4/1/08\ntuesdays and thursdays at 3:15\nubiflow on 24 Sep 2014 Petites corrections\nUpdate 2007-02-07\nWed. the 14th of May. 2014\nWeekdays 8:30am-4:30pm\nWhen _____ , I want to _____ , so I can _____ .\nWhere is part 5? Are there going to be 10 of these? Looking forward to more.\nyes';

str = '“2nd Saturday of every other month, 10:00 am-12:00 pm,” into a sequence of items in machine format?\n> Hello, I am Eliza.\n> How are you today.. What would you like to discuss?\n> I understand.\n05 Mar 2014 1:16 PM\n06-16-2014\n1, 14, 20 of each month\n14,565 total views, 176 views today\n2 Apr – Wed 10:00AM-10:45AM\n2 avril - Mer 10h00-10: 45am\n2 months ago\n2012-Jul\n2013-09-10 · Updated to Bootstrap 3.0.0 stable.\n';


var re = /\d+/gi; 
var m;
var c = 0; 
while ((m = re.exec(str)) !== null) {
    if (m.index === re.lastIndex) {
        re.lastIndex++;
    }
    // View your result using the m-variable.
    // eg m[0] etc.
    console.log(c, m[0]); 
  c++;
}

console.log("== 2 ============================================");

var text = str;
text.split(/\s+/).forEach(function(word) {
	console.log(word)	;
		});

console.log("== 3 ============================================");
text.split(/\W+/).forEach(function(word) {
	console.log(word)	;
		});

console.log("== 4 ============================================");

var m;
 c=0;
var re = /\w+/ig; 
while ((m = re.exec(str)) !== null) {
    if (m.index === re.lastIndex) {
        re.lastIndex++;
    }
    // View your result using the m-variable.
     console.log(c, m[0], m.index); 
 
   $("#results").append('<tr><td>' + '' + '</td><td>' +  m[0] + '</td></tr>');
  c++;
}</script></body>
</html>