Harry Coder
Harry Coder

Reputation: 2740

Retrieve a Regex Pattern from a MySQL table

I have a table in MySQL containing regex pattern such as : FILE\\\\d{1,4}. But while trying to retrieve the pattern value with a Java code, it seems like the value is not in the good format. How can I store this value in MySQL, to be able to retrieve the exact value I want in the code : FILE\\d{1,4} Thank you in advance.

Upvotes: 1

Views: 499

Answers (1)

Harry Coder
Harry Coder

Reputation: 2740

It is OK now. For this case, I just have to insert the regex pattern in the table with 4 backslash (\\) and while I retrieve it from the data base within JAVA, I got two backslashs (\). It is due to the escape character that MySQL applied. Thank you !

Upvotes: 1

Related Questions