Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
I get no solution for following problem:
I have 2 fields: 1 works as a pattern, e.g. *example* or *test.com. the other one "URL" contains several web addresses, e.g. http://www.test.com
I would like to generate a new field "Pattern_match" from these both fields where only the values of URL are included which match the pattern.
I already tried a solution like this, but then the matches have to be 100% identical:
Pattern_match:
LOAD fieldvalue('pattern_url',iterno()) as match
AUTOGENERATE 1
WHILE len(fieldvalue('pattern_url',iterno()))
;
INNER JOIN (Pattern_match)
LOAD fieldvalue('URL',iterno()) as match
AUTOGENERATE 1
WHILE len(fieldvalue('URL',iterno()))
;
Enclosed could be one option is your list of patterns are not too long and you are not working with millions of records.
Enclosed could be one option is your list of patterns are not too long and you are not working with millions of records.
thank you! it works but indeed the script now takes 21 seconds to calculate up from 3. in the url list i have got about 1500 datasets
I like Rakesh's solution. You might be able to speed it up by eliminating the for each loop. I don't think it necessary. I think it can be done with:
P4:
load URL as MatchedPattern
RESIDENT P2
WHERE wildmatch(URL, $(vAllPaterns));
See attached modifcation of Rakesh's example.
-Rob
after testing, rakesh's solution is the faster one for my case and works just fine. thanks to the both of you!