Extracting dates from text in Java

后端 未结 5 1842
旧时难觅i
旧时难觅i 2021-01-13 17:20

Is it possible to extract dates from a string in Java?

I have 500+ string with different data. In them, there can be:
\"... period from 08.23.2011 - 09.05.2011..

5条回答
  •  失恋的感觉
    2021-01-13 18:15

    In essence regex is the answer for recognition, but there are lots and lots of ways to express dates and time periods, so if you want a good solution, you probably want to use an existing well-tuned set of regex. There's then a second phase of interpretation, which needs more flexibility than what JodaTime will parse out of the box. So for a robust solution, you probably want to use one of the systems that have been built in the natural language processing community, such as SUTime, HeidelTime or GUTime.

提交回复
热议问题