Skip to main content
All CollectionsCustom Policies
Regex and XPath for Custom Policies
Regex and XPath for Custom Policies

Resources for learning how to use Regular Expressions and XPath to write Custom Policies in DubBot.

Updated this week

One of the most powerful analytical tools DubBot offers is the ability to write Custom Policies.

You can learn more by visiting our Collection of Help Articles on Custom Policies.

Custom Policies may be written using a variety of methods. In this article we will focus on Regular Expressions and XPath.

Regular Expression

Regular expressions, commonly abbreviated as regex, are patterns used to search, match, and manipulate text based on specific rules. It consists of special characters and syntax that define patterns to be matched against text data in an XML/HTML document. In DubBot, regex is used to search for patterns within strings. For Custom Policies in DubBot, Ruby Regex is used.

Below are some resources to help you get started with learning and practicing Regex.

Learn Regex Resources

  • Rexegg - an approachable beginner through intermediate guide to all things Regex.

  • Rubular - a Ruby Regex editor for testing.

  • Regex Crossword - a gamified experience for learning regex.

XPath

XPath is a query language used for navigating and selecting elements from XML documents. It provides a standardized way to address elements and attributes within XML structures, allowing users to extract specific data. XPath expressions resemble directory paths and can be used to locate nodes within XML documents based on their relationships, attributes, or content. In DubBot, a Custom Policy may use XPath to target very specific content according to its attributes or element location. XPath 1.0 is used in DubBot Policies.

Below are some resources to help you get started with learning and practicing XPath.

Learn XPath Resources

Still Need Help?

If you have questions, please reach out to our DubBot Support team via email at help@dubbot.com or via the blue chat bubble in the lower right corner of your screen. We are here to help!

Did this answer your question?