BeanShell - BuildMap Replace Word

columnUsername = columnUsername.replace("Domain\\", "");

Try this?

The reason I am asking is because in java replace and replaceAll methods handle the searchFor string differently. While replace method treats it as a character squence, replaceAll treats it as regex. This is an age old issue with Java and while using replaceAll method you will have to use \\\\ to escape a single \ as internally these are compiled by Java and then by regex. If you use replace then it is just compiled by Java and \\ will be treated a \

3 Likes