Manually input regular expressions

Kimono uses regular expressions to hone in on specific text within an element, and filter out elements that don't contain text matching the pattern. Say for example, you click on the following three list items:

Clicking gave us all of the data in each element. Let's imagine for a moment that we only want the movie name itself, not the episode number or year. A better way to do this is to click and drag over the data you want to generate more specific regular expressions.

If that still doesn't yield the information you want,  you can enter advanced mode and modify the regular expression to tell kimono to extract just the names.

By default, a generic regular expression is generated, which looks like this:

/^()(.*?)()$/.

The regular expression pattern in kimono is defined in three parts. It's important that any custom regular expression you produce retains the three part notation, with the surrounding ( ) for each part. The first part refers to the pattern to the left of the desired content. The middle part refers to the pattern that the desired content must match and the third part refers to the pattern to the right of the desired content.

The regular expression you need to get only the movie names from the list items above would look like this:

/( = )(.*?)( \(\d)/

After making these changes - namely adding  =  to the left pattern and  \(\d to the right - click

. We can see that the same three list items are selected, but only the movie names are highlighted. The data returned from the API call would reflect this change as well:

 

You can make all your regex adjustments in advanced mode where you can also specify your CSS selectors:

Coming up with the perfect regex to get exactly the data you want can be tricky. The Mozilla Developer Network site is a fantastic resource for learning everything you need to know about both.

Specifically, check out their documentation on Regular Expressions.

Powered by Zendesk