Forum Academy Marketplace Showcase Pricing Features

RegEx not behaving as expected

On my draft page called regex test of my app: https://route-manager.bubbleapps.io/

I have a group with the following text in it:

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.

Still struggling with this if anyone has any input!

Sorry for the delay.

I think you can do it by pulling out the #items from the regex.

You may need to set up a list of numbers using The Tool Box plugin to iterate this however.

image

So the RG will be based on a type of number from the ToolBox list and each how will pull out the relevant part of the Regex.

2 Likes

Thanks @NigelG! I did get the RegEx to pull the relevant text given a number and got it working in my app!

Hi - I’m looking to do the exact same, but I’m confused as to how you achieved it. Do you have an example or are you able to elaborate?

Any help would be really appreciated as I can’t see any other way of populating an RG wit the optimised route.

Thanks in advance

Howard