I am trying to extract the date from a string that can come in different formats such as:
Cod. principal: 785369-06 Fecha 14/10/2015
And even things after the date, such as:
Fecha 2015-11-24 asddsa12 Otros datos: 12202
How could I do to extract the 14/10/2015
from this String?
Isn't there a regular expression that allows me to take everything after "Date"? Or some other kind of solution.
From already thank you very much!
There I managed to solve it without external libraries:
It simply gets all the matches
matcher()
and returns them with thegroup()
You can use the function
split
. What this function would do is create an array taking as reference the word that you indicate.For your example you could use:
To do this you can use the natty library: http://natty.joestelmach.com/
Which would work for both cases:
case a)
case b)
Even to search for multiple dates in the same string:
Another option is how peers comment via split().