Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3615166
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:20:23+00:00 2026-05-18T22:20:23+00:00

I just need to verify that this regex statement will do what I want.

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T22:20:23+00:00Added an answer on May 18, 2026 at 10:20 pm

    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.

    public class ProviderTypeWrangler {
    
        public String getProvider(String json) {
    
            try {
    
                ObjectMapper mapper = new ObjectMapper();
                Integration integration;
                integration = mapper.readValue(json, Integration.class);
                return integration.getProvider();
            } catch (JsonParseException e) {
                return "";
            } catch (JsonMappingException e) {
                return "";
            } catch (IOException e) {
                return "";
            }
    
        }
    
    }
    

    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.

    public class WufooIntegrationRoutingSlip {
    
        @RoutingSlip
        public String slip(String body) {
            String answer = "activemq:noProducerDefined";
            ProviderTypeWrangler wrangler = new ProviderTypeWrangler();
            String producer = wrangler.getProvider(body);
            Logger mylogger = Logger.getLogger("log4j.logger.org.apache.camel");
            if (!producer.equals("")) {
                mylogger.info("Body:"+body);
                answer = "activemq:"+producer;
            }
            return answer;
        }
    
    }
    

    Then, in my camel.xml file I exposed this routing slip as a bean

    <bean id="integrationBean" class="com.wufoo.camel.WufooIntegrationRoutingSlip"/>
    

    And I used that bean to route the exchange to the correct queue.

    <route errorHandlerRef="dlc" autoStartup="true" id="IntegrationQueue" xmlns:ns2="http://camel.apache.org/schema/web" xmlns="http://camel.apache.org/schema/spring">
        <description>Send all integrations here.  Logic will parse to individual queue based on Provider.</description>
        <from uri="activemq:integration"/> 
        <bean ref="integrationBean"/>
    </route>
    

    I learned a lot about camel and spring along the way, so thanks to the commenters for pushing me in the right direction.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This code does not seem to compile, I just need to write something to
Seems so basic, I can't believe I don't know this! I just need a
I need a collection that works just like a Dictionary/Hashtable in a sense that
I need to create a midnight DateTime I've just done this: DateTime endTime =
I'm trying to find a regex that works to match a string of escape
just a quick question. First of all, let me verify that I have the
I have a need to verify a specific hyperlink exists on a given web
Problem: I want to write a process that will allow a user to take
I just need confirmation that I am doing XML parsing right. Am I doing
I just need a file (picture, pdf or other type file for printing) of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.