well, I give up hopefully someone out there can help me. this was my last try; <replaceregex pattern="^#example[\s|(?:^#)|.]+^#end example.*" replace="" flags="g" /> I thought the pattern specified the following; lines that start with '#example' followed one or more of {whitespace OR (lines that do not start with '#') OR any char} followed by lines that start with '#' followed by 'end example' followed by zero or more of [any character] where 'whitespace' is in the set {\n\t } but it does not delete the following sequence; #example F1 F2 $ . #end example junk
I specified the greedy pattern, '.', last so it doesnt eat '#' before it is excluded with the expression (?:^#) which I think means exclude lines that start with '#'. that way the pattern '^#end example.*', lines that start with '^' followed by 'end example', does not get eaten by greedy '.'. This is the complete thing I am trying to do. <copy overwrite="true" file="fields.txt" tofile="fields.rsc"> <filterchain> <tokenfilter> <replaceregex pattern="^#example[\s|(?:^#)|.]+^#end example.*" replace="" flags="g" /> <replaceregex pattern="#.*" replace="" flags="g" /> <deletecharacters chars="\t" /> <trim /> <ignoreblank /> </tokenfilter> </filterchain> </copy> everything but the first regex succeeds :( basically it strips out comments and everything between '#example' and '#end example' including newlines. This allows comments, and any examples, to be stripped out during copy so that the resulting field.rsc file doesn't have any unneeded stuff in it. This file will then be included in the jar archive. however, i'm stumped everything that I have tried has failed :( -----Original Message----- From: Scot P. Floess [mailto:[EMAIL PROTECTED] Sent: Thursday, June 14, 2007 3:57 PM To: Ant Users List Subject: Re: replaceregex I don't mean to sound smart...but have you tried it? Run a test? It might be time better spent if you run a test, it fails then email the list? Erica Ramsey wrote: > hello, will the following example replace everything between '#example > ' and > '#end example.*' ? I am trying to strip the following from a file; > > #example -- do not remove this line! > test1 #comment > test2 > $ > test3 #another comment > . > #end example -- do not remove this line! > > everything between '#example' and '#end example.*' must be stripped out. > > here is my expression: > <replaceregex pattern="#example(\n.)+#end example.*" replace="" > flags="g" /> > > Thanks! > -- Scot P. Floess 27 Lake Royale Louisburg, NC 27549 252-478-8087 (Home) 919-392-6730 (Work) Chief Architect JPlate http://sourceforge.net/projects/jplate Chief Architect JavaPIM http://sourceforge.net/projects/javapim --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.15/848 - Release Date: 6/13/2007 12:50 PM No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.15/848 - Release Date: 6/13/2007 12:50 PM --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]