Services Plugins FAQs

How to Use RegEx to Extract locations from instructions in Google Maps Extender Plugin

I’m using the add directions feature of the Google Maps Extender plugin to generate instructions for a route.
I am testing extracting addresses from the optimized route on my draft page called regex test of my app: https://route-manager.bubbleapps.io/

To test this, I have a group with the following text in it which is a sample of instructions for a route:

Route Segment: 1
10601 Derecho Dr, Austin, TX 78737, USA to Zilker Nature Preserve, 301 Nature Center Dr, Austin, TX 78746, USA
12.8 mi

Route Segment: 2
Zilker Nature Preserve, 301 Nature Center Dr, Austin, TX 78746, USA to Roy and Ann Butler Hike and Bike Trail, 900 W Riverside Dr, Austin, TX 78704, USA
2.0 mi

Route Segment: 3
Roy and Ann Butler Hike and Bike Trail, 900 W Riverside Dr, Austin, TX 78704, USA to East Austin, Austin, TX, USA
4.4 mi

This text will have a variable number of route segments.

I’m just using the above for the example.

I would like to extract the first address in each block of text so that each address is an item in a repeating group like the following:

10601 Derecho Dr, Austin, TX 78737, USA
Zilker Nature Preserve, 301 Nature Center Dr, Austin, TX 78746, USA
Roy and Ann Butler Hike and Bike Trail, 900 W Riverside Dr, Austin, TX 78704, USA

(where the above are items 1 - 3 in a repeating group).

When I test the following RegEx at regexr.com, it works:

(?<=Route Segment: \d)[\S\s]*?(?=to)

But when I use this regex in my app, it doesn’t generate any matches for my repeating group.

Basically, I’m trying to match all instances of text between Route Segment: /d (any number here) and to, and display them as items in a repeating group.

If there’s a better way to do this besides using RegEx, I’d love to know!

This question is being solved in the bubble.io forum here: https://forum.bubble.io/t/regex-not-behaving-as-expected/91953?u=harrisonalley