Skip to main content
Solved

use attribute value as regular expression in stringsearcher

  • November 28, 2014
  • 1 reply
  • 8 views

I think this should be easy but cannot work out how to use an attribute value as the regular expression in the string searcher transformer.

Best answer by takashi

Hi,

 

 

I think it's possible in general. For example:

 

Attributes of input feature (name: value)

 

_src: abc123

 

_regex: ^([a-z]+)([0-9]+)$

 

 

Parameter settings of the StringSearcher (refer to the attributes)

 

Search In: _src

 

Regular Expression: _regex

 

 

Logged result

 

Attribute(encoded: utf-8): `_matched_characters' has value `abc123'

 

Attribute(encoded: utf-8): `_matched_parts{0}' has value `abc'

 

Attribute(encoded: utf-8): `_matched_parts{1}' has value `123'

 

Attribute(encoded: utf-8): `_regex' has value `^([a-z]+)([0-9]+)$'

 

Attribute(encoded: utf-8): `_src' has value `abc123'

 

 

How's your actual situation?

 

 

Takashi
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

1 reply

takashi
Celebrity
  • Best Answer
  • November 28, 2014
Hi,

 

 

I think it's possible in general. For example:

 

Attributes of input feature (name: value)

 

_src: abc123

 

_regex: ^([a-z]+)([0-9]+)$

 

 

Parameter settings of the StringSearcher (refer to the attributes)

 

Search In: _src

 

Regular Expression: _regex

 

 

Logged result

 

Attribute(encoded: utf-8): `_matched_characters' has value `abc123'

 

Attribute(encoded: utf-8): `_matched_parts{0}' has value `abc'

 

Attribute(encoded: utf-8): `_matched_parts{1}' has value `123'

 

Attribute(encoded: utf-8): `_regex' has value `^([a-z]+)([0-9]+)$'

 

Attribute(encoded: utf-8): `_src' has value `abc123'

 

 

How's your actual situation?

 

 

Takashi