Skip to main content
Solved

use attribute value as regular expression in stringsearcher

  • November 28, 2014
  • 1 reply
  • 4 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
View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, 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
Influencer
  • 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

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings