Get url parameters

Hello everyone, I want to get parameters from my url.

Exemple:

www.teste.com.br/mensagem?idref=134&cid=654fas3&utml=g4h24g

Then I want to get this data for each field, like this

IDREF = 134
CID = 654fas3
UTML = g4h24g

to find out where else people are coming from.

Thanks

Hey @GSS_Innovations

Welcome to the make community

you can use Text parser here:

Output:
image

3 Likes

Welcome to the Make community!

Screenshot_2024-02-20_151445

You can use a Text Parser “Match Pattern” module with this Pattern (regular expression):

\?idref=(?<idref>[^&]+)&cid=(?<cid>[^&]+)&utml=(?<utml>[^&]+)

Proof

https://regex101.com/r/zQjzHw

Important Info

  • :warning: Global match must be set to NO!

Output

Screenshot_2024-04-12_000406


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!

You can copy and paste this module export into your scenario. This will paste the modules shown in my screenshots above.

  1. Copy the code below by clicking the copy button when you mouseover the top-right of the code block
    Screenshot_2024-01-17_200117

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV to paste in the canvas.

  3. Click on each imported module and save it. You may need to remap some variables.

Modules JSON Export

{
    "subflows": [
        {
            "flow": [
                {
                    "id": 93,
                    "module": "regexp:Parser",
                    "version": 1,
                    "parameters": {
                        "pattern": "\\?idref=(?<idref>[^&]+)&cid=(?<cid>[^&]+)&utml=(?<utml>[^&]+)",
                        "global": false,
                        "sensitive": true,
                        "multiline": false,
                        "singleline": false,
                        "continueWhenNoRes": false
                    },
                    "mapper": {
                        "text": "www.teste.com.br/mensagem?idref=134&cid=654fas3&utml=g4h24g"
                    },
                    "metadata": {
                        "designer": {
                            "x": -811,
                            "y": -1714,
                            "messages": [
                                {
                                    "category": "last",
                                    "severity": "warning",
                                    "message": "A transformer should not be the last module in the route."
                                }
                            ]
                        },
                        "restore": {},
                        "parameters": [
                            {
                                "name": "pattern",
                                "type": "text",
                                "label": "Pattern",
                                "required": true
                            },
                            {
                                "name": "global",
                                "type": "boolean",
                                "label": "Global match",
                                "required": true
                            },
                            {
                                "name": "sensitive",
                                "type": "boolean",
                                "label": "Case sensitive",
                                "required": true
                            },
                            {
                                "name": "multiline",
                                "type": "boolean",
                                "label": "Multiline",
                                "required": true
                            },
                            {
                                "name": "singleline",
                                "type": "boolean",
                                "label": "Singleline",
                                "required": true
                            },
                            {
                                "name": "continueWhenNoRes",
                                "type": "boolean",
                                "label": "Continue the execution of the route even if the module finds no matches",
                                "required": true
                            }
                        ],
                        "expect": [
                            {
                                "name": "text",
                                "type": "text",
                                "label": "Text"
                            }
                        ],
                        "interface": [
                            {
                                "type": "text",
                                "name": "idref",
                                "label": "idref"
                            },
                            {
                                "type": "text",
                                "name": "cid",
                                "label": "cid"
                            },
                            {
                                "type": "text",
                                "name": "utml",
                                "label": "utml"
                            }
                        ]
                    }
                }
            ]
        }
    ],
    "metadata": {
        "version": 1
    }
}
3 Likes