ij-macro-programming-workshop

Previous            Solution            Next

Exercise 03.04 - Strings - Regular expressions

Aims:

Write a regular expression that matches strings which contain _t followed by three digits. The following constructs might be useful:

An example: The regexp ".*[0-9][0-9]a.*" matches strings that somewhere contain two digits one after the other followed by an a (the prefix and postfix can be arbitrary strings).

Your code starts after this line

regExp = 

Your code ends before this line

The code below is for automatically checking the result. Please ignore it!


res = matches("A01GFP_c001_t001_z001.tif" , regExp);
res = res && !matches("A01GFP_c001_t0a1_z001.tif" , regExp);
if (res) 
	showMessage("That's right. Great, you did it!");
else 
	showMessage("Your result is wrong! Please check your macro and try again!");

Previous            Solution            Next