Link to home
Start Free TrialLog in
Avatar of Elizabeth "Smalls" Eckels
Elizabeth "Smalls" EckelsFlag for United States of America

asked on

Parse keys to return portion of key with Regex

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!
ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Elizabeth "Smalls" Eckels

ASKER

Thanks @RGonzo and @Dan - both worked great!