Replace String pattern in Java
- by Hirantha
I have the following string
"value=\"\\d{4}((((0[1-9])|(1[0-2]))((0[1-9])|([12]\\d)|(3[01]))?)?|(\\-(((0[1-9])|(1[0-2]))(\\-((0[1-9])|([12]\\d)|(3[01])))?)?)?)d{4}"
There I want to replace all the occurrences of
"{" with NCHAR(0x7B)
"}" with NCHAR(0x7D).
An the content in-between "{ }" should remain unchanged:
Ex: \\d{4} after replacing -> NCHAR(0x7B) 4 NCHAR(0x7D).
Is there a way to do this using Regular Expressions in Java?.
Anyway, this can be done processing the whole string using string operations.