Re: [Vala] regex to get some multiline text



On Wed, May 9, 2012 at 5:17 PM, Shawn Ferris <shawn ferris gmail com> wrote:

I'm not 100% sure on your use case, I didn't read it thoroughly, but I
believe you need to add a loop:


Oops.. I may have misunderstood your question.. I think you need to enable
multiline, which I believe is:

        Regex r = /\s*(?P<start>.*)\s*%tag:(?P<**k
ey>.*)%\s*(?P<content>.*)\s*%**endtag%\s*(?P<end>.*)/m;

Note the m (multiline compiler flag) following the regexp. I'm not 100%
sure on that syntax as I'm used to:

        Regex r = new Regex(""" \s*(?P<start>.*)\s*%tag:(?P<**
key>.*)%\s*(?P<content>.*)\s*%**endtag%\s*(?P<end>.*) """,
RegexCompileFlags.MULTILINE);


I inadvertently left the list off this reply.. However, MULTILINE was still
not enough.. '.' (dot) still wont match newlines w/o also
setting RegexCompileFlags.DOTALL.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]