2

As the title suggest i only want to replace content which starts # and skip content which starts with ! Here is the code snippet. it is not skipping the word which starts with !#

String test = "Hello #Admin  Welcome this is Your welcome page !#Admin  This is #Admin"

NOTE:- It must skip !#Admin when replacing.

String out = test.replaceAll("#Admin", "MyAdministrator");
log.debug("OutPut: "+out);

OutPut: Hello MyAdministrator  Welcome this is Your welcome page !MyAdministrator  This is MyAdministrator

How can i Ignore the word which starts with Exclamation mark.

THANKS.

4

2 に答える 2