I am trying to split a string using a regex "A.*B", which works just fine to retrieve strings between 'A' and 'B'. But the dot '.' doesn't include new line characters \n,\r. Can you please guide me on how to achieve this?
Thanks
Thanks all. Pattern.DOTALL worked like a charm.
I had another question related to this. What should be done if I need to extract all the strings between 'A' and 'B' (which basically match the above regex).
I tried using find() and group() of matcher class, but with the pattern below it seems to return the whole string.
Pattern p = Pattern.compile("A.*B",Pattern.DOTALL);
A[.\n\r]*Bwork ?