Login  Register

Re: Replace part of string help

Posted by dscho on Jul 28, 2011; 10:40am
URL: http://imagej.273.s1.nabble.com/Replace-part-of-string-help-tp3683695p3683700.html

Hi,

On Thu, 28 Jul 2011, Dr Adam Cliffe wrote:

> I'm trying to remove part of a file name.
> Current file name is : "Job(Seq.Scan) 2 02_024_z0_ch01.tif"
> I'd like to remove the (Seq.Scan) part.
>
> using the following macro I end up with: Job() 2 02_024_z0_ch01.tif
>
> name = "Job(Seq.Scan) 2 02_024_z0_ch01.tif";
> string=replace(name,"(Seq.Scan)","");

replace() takes a regular expression so parentheses are special. Try
"\\(Seq.Scan\\)" instead.

> print(name);

Maybe print(string)?

Ciao,
Johannes