Templates Plugins Courses

How to manipulate the output of Google Maps Extender by putting the text content of the optimized route in an input element

I am using this plugin to make a route manager that finds the most efficient route between two locations with multiple stops.

When the user chooses a location, it is stored in my database.

When they click a button to optimize their route, the plugin outputs route directions that look like this:

Route Segment: 1
Austin, TX, USA to 605 Azie Morton Rd, Austin, TX 78704, USA
2.2 mi

Route Segment: 2
605 Azie Morton Rd, Austin, TX 78704, USA to Zilker Nature Preserve, 301 Nature Center Dr, Austin, TX 78746, USA
1.1 mi

Route Segment: 3
Zilker Nature Preserve, 301 Nature Center Dr, Austin, TX 78746, USA to Dallas, TX, USA
198 mi

Once you choose to optimize your route, the plugin outputs the text of the optimized route to the text element with an ID of: instructions_id.

I would like to extract the text with RegEx and edit these locations in my database such that I can put them in a repeating group in the optimized order.

I already have the workflows and RegEx to extract these locations and make edits to them in my database such that I can order them properly.

However, as far as I can tell, with Bubble you can only extract text with RegEx using text input elements, NOT plain text elements.

Also, the plugin ONLY outputs the text to plain text elements, not input elements.

So I’m trying to find a way to populate a multiline input element with the text from a text element so I can then extract the text with from the optimized route with RegEx.

Here’s what I’ve tried:

  1. Setting multiline input’s initial content = the text element with instructions_id
  2. Setting multiline input’s placeholder text = the text element with instructions_id
  3. Creating a custom state for the multiline input = the text element with instructions_id and setting this state only after the text element has populated with text.

None of these have worked.

Would love some help with this.


Hello, @harrisonalley. Thanks for your questions.

With Bubble, it is possible to extract text with RegEx not only the input elements, but the text elements also (and lot more). Here is an example:

I’d like to advise you to check the RegEx use cases/tips/etc for more experience on this point:

And take look at these Bubble Forum references (they can be useful in a way):

I hope it helps :pray:

1 Like

Thanks! I feel dumb. I see that you can use regex with plain text elements now.

1 Like

Actually, I do have a follow-up question @kate.

To reiterate, my goal is to extract the text addresses from the instructions_id text output after a route has been optimized using the Google Maps Extender so that I can edit the corresponding addresses in my database to include their optimized order so that I can list them in that order in a repeating group.

When the user adds locations to their map and itinerary, these locations are added to a view in the database.

To order these locations according to their optimize route, I want to make changes to the locations in the database.

I’m using this regular expression: (?<=Route Segment: \d*\s)[\S\s]*?(?=\sto) to extract each item (except for the starting and ending location which don’t need be extracted and ordered) from the instructions_id text output.

I’ve tested this RegEx in Bubble by putting sample optimized route text in a multiline input element and using the above RegEx to extract any address in the list.

So I know the RegEx works and works within Bubble (at least when the text is in a multiline input element).

But when I try testing this RegEx extraction on my index page like this:

It doesn’t add any information to this item in my database.

I’m ensuring that Square Rapp is the 2nd item that RegEx would extract as you can see here:

I’ve also added a pause in my workflow. Would love for you to take a look. You can imitate my route by choosing Paris, France, then Eiffel Tower Views, then choose Square Rapp (far right top row), then make the 17th arrondisement your starting location and 12th arrondisement your ending location which will make Square Rapp the 2nd item that RegEx should extract.

Thanks in advance!


Apologies for the late reply :pray:

I’m afraid, I can not provide you with the solution to your exact issue. I hope these references will be useful to you. Please take a look:

Please accept my apologies for not being actually helpful :slightly_frowning_face:

Thank you for trying.