0

Using Google Refine, I'm trying to add a column based on the current column.

The current column contains url params, e.g.

q=how+to+match+google+refine+string&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a&channel=sb&gfe_rd=cr&ei=wpFCU-PfDZDd8gektIGoAw

How can I add a column for the q key?

Currently refine just gives me null when I try something as basic as:

value.match('/q/')

Update:

I managed to get the key: '.*?(ip=).*?'

But I'm looking now to get the value to the key. Either till the end of string or next '&'

pnuts
  • 58,317
  • 11
  • 87
  • 139
Tjorriemorrie
  • 16,818
  • 20
  • 89
  • 131

2 Answers2

1

match() performs matching over the whole string. So try with these two:

.*q.*

or using a word boundary \b:

.*\bq\b.*
Sabuj Hassan
  • 38,281
  • 14
  • 75
  • 85
0

value.match('.*?(q=)([^&]*).*?')[1]

gives

how+to+match+google+refine+string

Tjorriemorrie
  • 16,818
  • 20
  • 89
  • 131