PocketKnife - Regex Replacer

A workflow action to reformat your content with ease

What is the Regex Replacer function for? 

Standardize your data structure, transform data or refine values within text effortlessly. 

Utilize the Regex Replacer workflow action on the PocketKnife HubSpot add on to accomplish these. Simply define the Regular Expressions once, and let the workflow handle the rest of the process.

For example: get the domain from an email address.

 

How to set up Regex Replacer in PocketKnife? 

There is no setup needed within the PocketKnife HubSpot add on itself. The Regex Replacer workflow action is available in your HubSpot portal from the moment you connect it to PocketKnife

How to set up Regex Replacer in your HubSpot Portal?

Before you begin, please take note of some reminders and guidelines: 

  1. Make sure that you have access to your HubSpot portal 
  2. We strongly recommend that this feature only be used by those who have knowledge of Regular Expressions. Otherwise, you could negatively impact your database and content. 
  3. How does Regex work? You can explore a more detailed documentation on Regular Expressions by following the link on Regex 101. 
  4. Click this link to practice and do a Regex Test. 

 

Finally, to set up your Regex Replacer within HubSpot, start by:  

Creating a workflow. It could be a contact, company or deal workflow.

Follow this link to HubSpot’s Knowledge Base on how to create a workflow 

 

The example below shows you how to use the Regex Replacer workflow action to find and reformat a deal date. Follow the steps. 

Step 1: Create a (deal-based) workflow and set the trigger
Step 2: Choose the Regex Replacer workflow action from PocketKnife. 



Step 3: Define the reformatting action
This is where knowledge of Regex Regular Expression is critical. And if you're not acquaited with Regular Expressions, ChatGPT can help you out.

 

Select the appropriate options for the following fields.

  1. Text: Define (1) what you want to reformat or choose a text field property (2) to reformat
  2. Regex: define the Regular Expressions Again, this is where having a knowledge of Regex is very important. 
  3. Replacement: define the outcome

    (1) Define what you want to reformat


    (2) A property to reformat



    1. Step 4: Add a branch (OK, ERROR) based on the RegEx Replacer action above
      1. Choose for the branch action based on one property or action output 

      2. Choose for Action output Status + click Next

      3. Set Branch 1 to value OK. Set Branch 2 to ERROR


      Step 5: (or) Add action outputs based on successes and failures
    2. If the RegEx Replacer is successful, choose to set the action output result (that is, the outcome) in a text field property. For the property, you can choose an existing property or create a new one.


    3. Success message




      Error message
    4. If the RegEx Replacer failed, you can choose to get a notification about it with an error message or task to fix the issue. Based on this, you should choose the action output status. 



    Step 6: (or) Add action output based on Changed

    This action output returns:

    • true: the result is different from the original string
    • false: the result is the same as the original string (no changes are made)

    a. Choose branch based on One property or action output

    b. Select Action outputs Changed

    c. Define de output Changed as "True" and if not, define as "Error"

    Complete the workflow with the result property and send for example an internal mail in case of an error result.

     

    Congratulations!  

    You’ve just set up the RegEx Replacer feature of leadstreet's PocketKnife HubSpot add on.

     

    Monitor the performance of the Regex Replacer Workflow Action 

    On the PocketKnife dashboard you can monitor how many Regex Replacers are running.

    The number allowed depends on your PocketKnife HubSpot add on subscription plan (Freemium, your Single Feature, Pro or Enterprise).

    To upgrade your subscription plan, go to Subscription & Billing under the username of your account and choose the plan that fits your needs.

     

    Any Questions 

    Please contact our support team via this form