Is there a way to parse a date in a string using Datejs?

I recently met Datejs and found it very useful. However, I could not figure out if there was a way to parse the string and extract only part of the date from it.

For example, if there is a line → "I will start the exercise next Monday."

Then he should analyze the string, extract from it "next Monday" and convert it to a date and give me the result.

How can this be implemented?

Thank:)

+5
source share
1 answer

RegEx. . "" . . .

Edit:

- :

var pattern = /^([\w\W.]*)(next){1}([\sa-zA-Z]*)/;
while (result = pattern.exec(yourTextVariable) != null){
   // read the data as you need from the result array
}

, next , . ( , RegEx - . , : javascriptkit.com)

+3

All Articles