I've got a pdf file turned into a huge string of over 1,000,000 characters. There are dates in the string in the format dd/mm/yyyy. I want to split the string by dates into smaller ones. I tried following:
var sectioned = hugeString.split(/^(0?[1-9]|[12][0-9]|3[01])[\/](0?[1-9]|1[012])[\/\-]\d{4}$/g);
But it's not working. I also tried hugeString.match(), but no good result there.
Is it even possible to accomplish this by string functions or should I think of a different approach?
String snippet:
....Section: 2 Interpretation E.R. 2 of 2012 02/08/2012 .....
^and$anchors from that regex. They are needed when you want a string to be a date in its totality, but not when the string is allowed to have other text surrounding it..split(/(?:0?[1-9]|[12][0-9]|3[01])[\/-](?:0?[1-9]|1[012])[\/-]\d{4}/)- remove anchors,gmodifier and use non-capturing groups. Wrap in(?=PATTERN HERE)if you need to split keeping the dates in the split chunks.