Question

stringsearcher to feature

  • 21 November 2016
  • 2 replies
  • 36 views

I have a feature class, and one of the fields is "tag". In the tag there are different slices of information stuffed. I need to get the next part: "addr:street"=>"East 79th Street".

The first part "addr:street"=> is always the same, it is the second part that differents every time.

I tried to use the "StringSearcher", Search In: "tag", Regular Expression: "addr:street"=>"([a-zA-Z0-9]+)".

But I now get no matches at all.

Is there anyone who can help me?


2 replies

Userlevel 2
Badge +17

Hi @remcohofs, I think the character class in the regex should contain the white space.

Alternatively, the AttributeSplitter (Delimiter or Format String: =>) might also be helpful in this case.

Userlevel 4
Badge +25

If it is ALWAYS the first part, then I would use the SubstringExtractor. Set the Start Index parameter to 17 (the first character after the third ") and the End Index to -2 (the character before the final ")

That will give you the East 79th Street part, without quotes around it. If you wanted the quotes, then use 16 and -1 instead.

It's more hard-coded than a regular expression, but if the first part is always the same this way is much quicker to set up.

Reply