Regex - Extract digits from a url

Hi people, thanks for help me

I’ve this URL https://yoursite.com/?fluent-booking=calendar&host=barberia-valbuena&event=210min&userid=1082199790

I need extract all numbers after &userid= and save it like usuarioid with REGEX

I use this code

([\d]+)

But only show me 1st numbes on the url “210” in ths url for example, but I need the numbers on &userid=

Thanks

Hey @Luis_Garcia1
You should try this pattern

&userid=([\d]+)

This should capture all the numbers following &userid= in your URL.

2 Likes

Hi, thanks for reply, how can I set a name for this result ? for example= usuarioid

Hey @Luis_Garcia1
you can set name in “Set variable”

like this :

3 Likes

Thanks a lot for u help

3 Likes

Welcome to the Make community!

You can use a Text Parser “Match Pattern” module with this regular expression pattern

[?&]userid=(?<usuarioid>[\d]+)

Regex test: https://regex101.com/r/E43OZh

Using a “Named Capture Group” will directly output your capture as a named variable, so you don’t have to use another “Set variable” module to set the name of the variable.


For more information, see Text Parser in the Make Help Center:

Match Pattern
The Match pattern module enables you to find and extract string elements matching a search pattern from a given text. The search pattern is a regular expression (aka regex or regexp), which is a sequence of characters in which each character is either a metacharacter, having a special meaning, or a regular character that has a literal meaning.

Hope this helps!


Links

Here are some useful links and guides to help you get started and learn more on how to use the Make platform, apps, and app modules —

General

Help Center Basics

Articles & Videos

3 Likes