I just need to verify that this regex statement will do what I want.
Given the following json string
{"a":"1","Provider":"WebHook","b":"2"}
I need to ensure that the following regex
(?<=\bProvider":")\w+
Will always return the word following the string Provider”:”
In this case, the word following string Provider”:” is WebHook, but it could be any word. I have control over this word, so it will never contain non-ascii characters.
I will be using this expression in Apache Camel, which uses the java regex engine.
Can anyone spot any pitfalls in my strategy.
Ok, thanks for the advice guys. I bit the bullet and did things the right way, instead of parsing the regex. Here’s my solution:
I built a service which uses the org.codehaus.jackson.map.ObjectMapper. This class takes the exchange body as an argument. It looks like this.
I then used the routing slip pattern to provide access to this service. If anyone thinks another EIP would be appropriate, I’d be open for suggestions. Anyway, here’s an example of that.
Then, in my camel.xml file I exposed this routing slip as a bean
And I used that bean to route the exchange to the correct queue.
I learned a lot about camel and spring along the way, so thanks to the commenters for pushing me in the right direction.