Solved

Parse keys to return portion of key with Regex

Posted on 2016-07-15
3
75 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 48

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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Suggested Solutions

Why would you want to link Google Analytics to Google AdWords? After linking them, you can: Import goals and transactions from Analytics View  site engagement data from Analytics in AdWordsCreate remarketing lists in Analytics to use in AdWords for…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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.

747 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now