DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23106>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23106

Regexp Mapper:  Empty selection groups return string "null"





------- Additional Comments From [EMAIL PROTECTED]  2003-09-11 15:27 -------
Ooops...  how did I do *that*?!?

Assume a directory with two files with numeric names:
   1-06
   7

We want to rename these files to "After-1-6" and "After-7".

The ant script below will result in the files being renamed to

   After-1-6
   After-7nullnull

----
<project name="Package" default="all" basedir=".">
  <description>
    ANT Build file to create zip file for release, move it to the
    releases directory, and notify everyone it is ready.
  </description>

  <target name="all">
    <copy todir="${basedir}" >
       <fileset dir="${basedir}">
         <include name="*"/>
         <size value="0"/>
       </fileset>
       <mapper type="regexp"
         from="([1-9])(-)?(?:0)?([0-9]{1,2})?"
         to="After-\1\2\3"
       />
    </copy>
  </target>
</project>

----

End of a run with ant -debug

all:
fileset: Setup scanner in dir S:\shared\2003-TEST with patternSet{ includes: [*]
 excludes: [] }
     [copy] 1-06 added as After-1-6 doesn't exist.
     [copy] 7 added as After-7nullnull doesn't exist.
     [copy] Copying 2 files to S:\shared\2003-TEST
     [copy] Copying S:\shared\2003-TEST\1-06 to S:\shared\2003-TEST\After-1-6
     [copy] Copying S:\shared\2003-TEST\7 to S:\shared\2003-TEST\After-7nullnull


BUILD SUCCESSFUL

I believe that the regexp mapper should append empty strings in place of "null" 
to the result of the mapping.

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

Reply via email to