THX Bob,  I didn't get the multiline to work, but I did the desired results 
with use of the \s and \S whitespace and non-whitespace shorthands.

<regex 
pattern="^[\s\S]*${startstring}(?'matchedLines'[\s\S]*)[\s\S]*${endstring}" 
input="${fileContent}"/>
<echo message="${matchedLines}" file="${outputfilename}" append="true"/>

----- Original Message ----
From: Bob Archer <[EMAIL PROTECTED]>
To: Curtis Zarger <[EMAIL PROTECTED]>; nant-users@lists.sourceforge.net
Sent: Thursday, May 17, 2007 11:24:57 AM
Subject: Re: [NAnt-users] regex: reading across lines

Try adding options="Multiline" to your regex task.

BOb


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Curtis
Zarger
Sent: Thursday, May 17, 2007 11:07 AM
To: nant-users@lists.sourceforge.net
Cc: Curtis Zarger
Subject: [NAnt-users] regex: reading across lines

Hello,

I have a text file. I want to extract all of the lines that are between
two unique strings within the file.  I've only been able to extract the
text that's between two strings, on a single line.

The file format is below, as well as the regex task.  The problem is
that the regex only reads one line, I suspect due to my lack of
understanding of the regex wildcarding regarding newline characters.
Can anyone clear me up on this?

<unwanted lines>
fred red blue
<wanted lines>
Mary yellow brown
<unwanted lines>


<property name="infilename" value="D:\CI-TF-dev\tmp\dummy.txt"/>
<loadfile file="${infilename}" property="fileContent" verbose="false"/>
<regex pattern="^fred(?'outpp'.*)blue" input="${fileContent}"/>
<echo message="output: ${outpp}"/>

[echo] output: red

THX

Curt


------------------------------------------------------------------------
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users




-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to