Hi Albert, for the first problem I think you need to take a look at your
regex.  Try testing it out using the demo on the oro site
http://jakarta.apache.org/oro/demo.html

Possibly part of the problem is with the "greedy" operator '*'.  Take a look
at the javadoc for the package org.apache.oro.text.regex at the section near
the bottom which talks about "greedy operators".  The other problem is with
the parentheses.

Try this expression (note the use of round brackets with "|"):
<civ(.|\n)*?(class)

Really, this question should be directed at the Ant list as it's specific to
Ant's use of regexes.  The actual engine Ant uses to perform matching is
mostly irrelevant.

hth

Dave

> -----Original Message-----
> From: Albert Sidelnik [mailto:[EMAIL PROTECTED]
> Sent: 19 March 2003 00:14
> To: [EMAIL PROTECTED]
> Subject: Problem with regular expression..please help
> 
> 
> I've been stumped for a few days with a particular search/replace
> expression that I'm using under Ant 1.5.1 which is
> using Jakarta Oro for it's regex engine. Here are the details to my
> problem:
>  
> The keyword that I'm searching for and trying to replace is 
> the keyword
> "class". I'm trying to replace it with the word "trainingClass"
> as in the following example:
>  
> <civ:validateForm name="HomePageForm"
>     method="post"
>     action="utilities/Homepage/homepage"
>     class="org.civ.architecture.validation.FormValidation"
>     schema="/WEB-INF/Constraints.xsd"
>     pageMbde="<%=PageMbde.EDIT%>">
>  
> the version I'd like to have would be the following:
> <civ:validateForm name="HomePageForm"
>     method="post"
>     action="utilities/Homepage/homepage"
>     trainingClass="org.civ.architecture.validation.FormValidation"
>     schema="/WEB-INF/Constraints.xsd"
>     pageMbde="<%=PageMbde.EDIT%>">
>  
> Here is the expression that I'm using:
> (<civ[.|\s]*)class
>  
> Here is the exact ant syntax that I'm using:
> <replaceregexp
>     match="(&lt;civ[.|\s]*)class"
>     replace="\1trainingClass"
>     flags="mg"
>     byLine="false">
>     <fileset dir=...../>
>  
> Now to add more of a twist to this..there are more than one occurances
> to the tags mentioned above that appear in my jsp's. So
> they all would need to be evaluated for that particular expression.
> Can somebody help me out. This is killing me. Thanks
> -Albert
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to