I am using java Pattern Matcher api to search and replace tokens in a string. My string looks like below
Org Name: ${org_name}, Agent(s): ${agents}, OrgID: ${org_id}, ...
Here ${string} is the pattern I need to replace. I using regex like below
${(org_name|agents|org_id)}
But Pattern.compile is throwing exception. How to escape especial characters in this regex? or is there a better way of writing regex for this case?
\\$\\{(org_name|agents|org_id)\\}... obey the @Wiktor - Tim Biegeleisen