Solved

Parse keys to return portion of key with Regex

Posted on 2016-07-15
3
101 Views
Last Modified: 2016-07-15
Hi! Looking for some regex help again...

I have an analytics tool which allows me to take Regex and pull out specific parts of a key. In my example below, I'm looking to pull out the values which are in the third slot of the delimiter ":" and I can use the $ to reference a value to return.

Example Keys
     manifest_acquisition_summersale
     gglp:paidsearch_nb_b2b:thisisthekeyword:thisistheoccassion
     gglp:paidsearch_nb:paid keyword:rewardsclub
     gglp:paidsearch_nb:gifts:sale
     gglp:paidsearch_things:keyword_phrase

Expected Result
     (no match expected)
     thisisthekeyword
     paid keyword
     gifts
     keyword_phrase

What I've tried:
This failed -->
 ^gglp:([^:]+)$ 

Open in new window

This failed -->
 ^gglp.*:([^:]+)$ 

Open in new window

and then I referenced $1  to return what was matched

Results Returned with what I've tried:
None -- all tries have failed. :( Help please!
0
Comment
3 Comments
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 350 total points
ID: 41712662
Hi,

pls try to catch the second element (maybe $2)

(gglp:.*?:)([^:]+)

Open in new window

Regards
0
 
LVL 34

Assisted Solution

by:Dan Craciun
Dan Craciun earned 150 total points
ID: 41712705
Or stick with $1:
(?:gglp:.*?:)([^:]+)

Or, if "gglp:paidsearch" is a constant:
gglp:paidsearch.*?:([^:]+)

HTH,
Dan
0
 

Author Closing Comment

by:Elizabeth "Smalls" Eckels
ID: 41712834
Thanks @RGonzo and @Dan - both worked great!
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
need some regex help 15 29
Catchy phrases for IT Services 3 88
Alternative to LeadPages.com 3 100
regex expression 9 60
This story has been written with permission from the scammed victim, a valued client of mine – identity protected by request.
Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question