You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by jonese <gi...@gmail.com> on 2008/02/15 21:01:41 UTC

replaceregexp issues...

Ok i have this:

<replaceregexp file="database.sql" match="\0" replace="" flags="g" />

and i keep getting this error when i run my ant task

BUILD FAILED
C:\working\isirv\build.xml:151:
java.util.regex.PatternSyntaxException: Illegal octal escape sequence
near index 2
\0
  ^

The error is pointing to whatever occurs AFTER the \0

i've tried
[\0]
\0
\0{1,}
(\0){1,}
[\0]{1,}

same thing.

anyone? i tought this was supposed to allow for PERL5 syntax??

jonese

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: replaceregexp issues...

Posted by Gilbert Rebhan <an...@schillbaer.de>.

> Ok i have this:
> <replaceregexp file="database.sql" match="\0" replace="" flags="g" />
> and i keep getting this error when i run my ant task
> near index 2
> \0

the match attribute should contain your regular expressions (where
btw in java '\' has to be masked with a leading '\' so it should be
'\\') not a group, a '\' followed by a digit means a specific group of
your regular expression f.e. \0 =all, the whole match, \1 = group 1,
\2 = group 2 ... and so on

so you should write something like (don't know your regular expression
or text you need to replace)
<replaceregexp file="database.sql" match="\d+(blabla)\d+" replace="\1"
flags="g" />

If you want further help you should come up with more details.
What do you need to be replaced in your sql file ?
Maybe some snippet of your sql would be helpful.

Regards, Gilbert

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: replaceregexp issues...

Posted by jonese <gi...@gmail.com>.
Got it....

needed to use Unicode Equivilent \p{IsCntrl}

FYI for those who need it:

http://perldoc.perl.org/perlre.html

jonese

On Feb 15, 2008 3:01 PM, jonese <gi...@gmail.com> wrote:
> Ok i have this:
>
> <replaceregexp file="database.sql" match="\0" replace="" flags="g" />
>
> and i keep getting this error when i run my ant task
>
> BUILD FAILED
> C:\working\isirv\build.xml:151:
> java.util.regex.PatternSyntaxException: Illegal octal escape sequence
> near index 2
> \0
>   ^
>
> The error is pointing to whatever occurs AFTER the \0
>
> i've tried
> [\0]
> \0
> \0{1,}
> (\0){1,}
> [\0]{1,}
>
> same thing.
>
> anyone? i tought this was supposed to allow for PERL5 syntax??
>
> jonese
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org