[EDITED - really sorry, the code I quoted was wrong - have changed the message below to reflect this. Apologies! Thank you for your patience.]
I'm new to regular expressions and want to match a pattern in Java (following on from this solution - http://stackoverflow.com/questions/962122/java-string-get-everything-between-but-not-including-two-regular-expressions).
The string is [EDITED]:
<row><column name='_id'>1</column></row><row><column name='text'>Header\n\n\ntext</column></row><row><column name='pwd'>password</column></row>
And I want to return only what's between the column name='text' tags, so:
Header\n\n\ntext
I've got the code below [EDITED], but it doesn't match. Any ideas on how I need to change the Pattern?
Thanks!
package test;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
    public class Regex {
        public static void main(String[] args) {
            Pattern p = Pattern.compile(
                    "<row><column name='text'>(.*)</column></row>",
                    Pattern.DOTALL
                );
            Matcher matcher = p.matcher(
                    "<row><column name='_id'>1</column></row><row><column name='text'>Header\n\n\ntext</column></row><row><column name='pwd'>password</column></row>"
                );
            if(matcher.matches()){
                    System.out.println(matcher.group(1));
            }
        }
    }