Solved

Parse keys to return portion of key with Regex

Posted on 2016-07-15
3
103 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 50

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
at what point should Google AdSense be considered or used? 3 96
Python Regex Problem 24 140
regx  exclude  pattern 6 48
Help with a regex 3 44
Read about how to choose the best possible content marketing agency to suit your needs. Content marketing has become an integral part of running a successful tech business, so it is wise to be informed.
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.
An overview of how to create reports in Adobe Analytics (formerly Omniture Site Catalyst) using pageNames, events, eVars and props. This video will show you how to install the Omniture Debugger tool so can see (and test) what is being passed int…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

820 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