Hi,
I have saved some regular expressions in Oracle database and retreiving them in my
java code.
For e.g., "ABC\\d{2}" when comes to java after retrieval comes as
String str = "ABC\\\\d{2}" and length of both are not same. Hence when I use scanner object to find this
pattern in my input string, it is not able to find.
But if I do system.out.println(String from data base); I get output as ABC\\d{2}.
What I think is java treats special characters like back slash in different way and to add escape sequence my string is modified and Scanner.findInLine(pattern) returns null object.
Length of both strings I mean whatever comes from dB and original are not same though while debugging and while printing output on console both looks same.
WorkAround- I tried saving pattern as "ABC\d{2}" in database and when it came to java it came as "ABC\\d{2}" and hence my code worked.
Please let me know, if there is a better way to do it or if some other approach is there. I want to save correct pattern "ABC\\d{2}" in database and then retrieve it.
Couldn't share my code because of security concerns, please let me know, if you require more information to resolve this.
Thanks