Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Regular Expressions
  4. Parsing Session Campaign Data in Data Studio

Parsing Session Campaign Data in Data Studio

Scheduled Pinned Locked Moved Regular Expressions
regexjsonquestion
2 Posts 1 Posters 7 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Michael Oct2022
    wrote on last edited by
    #1

    I am trying to create a formula in Data Studio using RegEx that extracts the channel from the below URLs, all channels are passed as the first value before the first _

    ppcnonbrand_sports_uk_google_ourwebsite_b5g5_onlinebetting
    crm_sports_uk_email_ourwebsite_b5g5_welcomeemail4b_signin_0_0_0
    crm_sports_uk_email_ourwebsite_superboost_221206crmuksportstuenewsletterb_bethere_221206_rnd_0
    socialbrand_sports_uk_facebook_ourwebsite_none_carouselawareness_23852435274560534_23852435274610534_0_Facebook_Desktop_Feed_23852435274780534

    so from the above i want to return:

    ppcnonbrand
    crm
    socialbrand

    I have tried the following but it only returns "null" for everything .. i'm all out of ideas, can anyone suggest something?

    REGEXP_EXTRACT(Session Campaign, "^[^_]*")

    M 1 Reply Last reply
    0
    • M Michael Oct2022

      I am trying to create a formula in Data Studio using RegEx that extracts the channel from the below URLs, all channels are passed as the first value before the first _

      ppcnonbrand_sports_uk_google_ourwebsite_b5g5_onlinebetting
      crm_sports_uk_email_ourwebsite_b5g5_welcomeemail4b_signin_0_0_0
      crm_sports_uk_email_ourwebsite_superboost_221206crmuksportstuenewsletterb_bethere_221206_rnd_0
      socialbrand_sports_uk_facebook_ourwebsite_none_carouselawareness_23852435274560534_23852435274610534_0_Facebook_Desktop_Feed_23852435274780534

      so from the above i want to return:

      ppcnonbrand
      crm
      socialbrand

      I have tried the following but it only returns "null" for everything .. i'm all out of ideas, can anyone suggest something?

      REGEXP_EXTRACT(Session Campaign, "^[^_]*")

      M Offline
      M Offline
      Michael Oct2022
      wrote on last edited by
      #2

      I found a solution that worked:

      REGEXP_EXTRACT(Session campaign, "^([^_]+)")

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups