ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scot P. Floess" <flo...@mindspring.com>
Subject Re: Am i doing this right RE: ReplaceRegExp
Date Tue, 12 Feb 2008 19:40:50 GMT
This worked for me just fine...

Here is my build.xml:

<project>
      <replaceregexp file="some.sql"
                         match="\[[a-zA-Z0-1]{1,}\]"
                         replace="[100]"
                         byline="true"/>
</project>

Here is my sample file some.sql:

USE [dacsdce]
/****** Object:  Default [DF_formEnvironment_adminonly]    Script
Date: 01/29/2008 20:15:03 ******/
IF  EXISTS (SELECT * FROM sys.default_constraints WHERE object_id =
OBJECT_ID(N'[dbo].[DF_formEnvironment_adminonly]') AND
parent_object_id = OBJECT_ID(N'[dbo].[formEnvironment]'))

Here is the result:

USE [100]
/****** Object:  Default [DF_formEnvironment_adminonly]    Script
Date: 01/29/2008 20:15:03 ******/
IF  EXISTS (SELECT * FROM sys.default_constraints WHERE object_id =
OBJECT_ID(N'[100].[DF_formEnvironment_adminonly]') AND
parent_object_id = OBJECT_ID(N'[100].[formEnvironment]'))



jonese wrote:
> I used Regex Coach to debug the expression and it shows it working.
>
> HOWEVER when run my target using -debug i get the following
>
> sql-gen-schema-file:
> [replaceregexp] Replacing pattern '\[[a-zA-Z0-1]{1,}\]' with
> '[healthinteractionsbs]' in 'C:\working\healthinteractions.com\DB\MS
> SQL 2005\boomsocket_MSSQL_2005.sql' with flags: 'i'.
> [replaceregexp] No change made
>
> the .sql file looks like so
>
> USE [dacsdce]
> /****** Object:  Default [DF_formEnvironment_adminonly]    Script
> Date: 01/29/2008 20:15:03 ******/
> IF  EXISTS (SELECT * FROM sys.default_constraints WHERE object_id =
> OBJECT_ID(N'[dbo].[DF_formEnvironment_adminonly]') AND
> parent_object_id = OBJECT_ID(N'[dbo].[formEnvironment]'))
> <<SNIP>>
>
> it should change USE [dacsdce] to USE [healthinteractionsbs]
>
> anyone see anything wrong with my regex or the file data?
>
> thanks in advance
> eric
>
>
> On Feb 12, 2008 1:03 PM, Scot P. Floess <floess@mindspring.com> wrote:
>   
>> Are you sure the reg ex is working?  If not, nothing will be changed in
>> the file...
>>
>> Can you send the sql file or some snippet of it?
>>
>>
>>
>> jonese wrote:
>>     
>>> I have a simple build file and i'm trying to change some text in a .SQL file.
>>>
>>> in my build file i have the following target
>>> <target name="sql-gen-schema-file" description="generates the file
>>> which creates tables, views etc">
>>> <replaceregexp file="DB/MS SQL
>>> ${db.server.version}/boomsocket_MSSQL_${db.server.version}.sql"
>>>       match="\[[a-zA-Z0-1]{1,}\]"
>>>       replace="[${db.name}]"
>>>       flags="i" />
>>> </target>
>>>
>>> I know the regex is good but every time i run it nothing happens to my
>>> .SQL file.
>>>
>>> am i missing something?
>>>
>>> Running ant 1.7.x on Windows XP Pro
>>>
>>> eric
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>> For additional commands, e-mail: user-help@ant.apache.org
>>>
>>>
>>>
>>>       
>> --
>> Scot P. Floess
>> 27 Lake Royale
>> Louisburg, NC  27549
>>
>> 252-478-8087 (Home)
>> 919-754-4592 (Work)
>>
>> Chief Architect JPlate   http://sourceforge.net/projects/jplate
>> Chief Architect JavaPIM  http://sourceforge.net/projects/javapim
>>
>> Architect Keros          http://sourceforge.net/projects/keros
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>   

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim

Architect Keros          http://sourceforge.net/projects/keros


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message