I want regular expression to find & replace first and third rownum word in the below-given string with the word NONE.
String str = "select dummy,rownum,rowid as \"rownum\",rownum as order_number from dual";
I have tried below regular expression but it replacing the comma , before or after the word rownum
str = str.replaceAll("(?i)[^\"A-Z0-9]rownum[^$\"A-Z0-9]"," NONE ")
Actual Output : select dummy NONE rowid as "rownum" NONE as order_number from dual
Expected Output : select dummy,NONE, rowid as "rownum",NONE as order_number from dual