Hi, 

-----Original Message-----
From: Vihan Pandey [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 27, 2007 4:35 PM
To: Ant Users List
Subject: Re: replaceregex issues

>
> <replaceregex pattern="[\.\./]{1,}(h.+)" replace="\1" flags="m"/>
>

/*
Thanks a million Gilbert !!! I REALLY appreciate all the effort you
have taken in thinking of this and testing it out :-) However i've
noticed something strange that the replaceregex task fails in
cretain(but not all) cases(if there are a VERY large number of files
nested in a deep directory structure and/or the files are a little
messed up)
*/

strange things = memory problems, error messages or
does the replacement not work anymore with some files ?

the regular expressions [\.\./]{1,}(h.+) means
the string ../ one or more times followed by the character h followed
by any character (not anything as dotall flag not set) one or more times
captured in a group and should work with the most implementations
of regexp; it does with ruby for example.

/*
We have developers working Windows, GNU/Linux and Mac OS X who check
in these files into a subversion respository(from which we check out
via an ant script then deploy). The result of this heterogeneous
development environment is a lot of ^M's and other control and escape
characters all over the place thus a nicely structured file with good
newlines becomes a one liner full of of junk characters and looked
messed up. This is not a problem as the webserver can read the file on
deployment.
*/

I'm SURE you'll get problems with those files someday in some way.
Even on several platform with different editors one has to create some
kind of style guide every developer has to follow, i.e.=
2 or 4 spaces instead of tabs, linefeeds all unixconform means LF
instead
of CR+LF when mixed platforms, path separators all unix = '/',and
finally
no endless one liners but well structured files as sometimes
humans have to read it too ;-)

/*
After a lot of thinking i decided to use sed in a shellscript via
sed(which in my experience is the best for such messed up files).
*/

two things when using shellscripts =

i would have recommend the use of the <shellscript> task of antcontrib
if you were using <exec> but i see you already use it :-)

keep in mind when using a shellscript you open a new
process, doesn't run in the VM of ant


Regards, Gilbert

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

Reply via email to