I try write a regular expresion to get some text, something like this:

int main () {
        string the_string = """
         start text line 1
         start text line 2
         %tag:keytag%
         the content betwen tag line1
         %endtag%
         the end line 1
         the end line 2
         """;

Regex r = /\s*(?P<start>.*)\s*%tag:(?P<key>.*)%\s*(?P<content>.*)\s*%endtag%\s*(?P<end>.*)/;
        MatchInfo info;
        if(r.match(the_string, 0, out info)) {
            var s = info.fetch_named("start");
            var key = info.fetch_named("key");
            var cont = info.fetch_named("content");
            var e = info.fetch_named("end");

            print("%s\n",s);
            print("%s\n",key);
            print("%s\n",cont);
            print("%s\n",e);
        }

        return 0;
}

problem 1.the var s only get the one line (" start text line 2"). How can i get all line in s,e vars?
problem 2. if betwen %tag - %endtag is multiline dont work the expresion.

Attachment: smime.p7s
Description: Firma criptográfica S/MIME

_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to