Hi all,
I am new to java regex.
I have a string that contains three occurences of the word 'TEST'. Each of this word is followed by ^ and I need to check if the content between 2 and and 3rd occurence of ^ is blank, if it is blank/empty search further to see if the content between the 5th and 6th occurence of the ^ is "" If it is "", then replace it to be blank/empty
I need to repeat this logic check whenever TEST word is found.
Example:
Existing string:
aaaa^
TEST^x^^y^z^""^cccc^bbb^
bbbb^
TEST^p^^q^r^""^lll^mmm^
TEST^P^X^q^n^""^hhh^ttt^
Expected string:
aaaa^
TEST^x^^y^z^^cccc^bbb^
bbbb^
TEST^p^^q^r^^lll^mmm^
TEST^NOT EMPTY THUS IGNORE^X^q^n^""^hhh^ttt^
How do I do it.
Any help is highly appreciated.
Thanks in advance.