Skip to main content

Hello,

 

 

I would like to replace the strings that only consists of number for example :11

Although I have string that are for example 11 xxx which should not be replaced.

 

 

In short, if the digit is followed by any word character Stringreplacer shouldn't select it but if the number is there buy itself then select it.

You could use the StringSearcher transformer with the regular expression: ^[0-9]*$

(meaning start then only digits then end).


Try the following in a StringReplacer:

^\d+$

It will only replace the attribute values that are entirely made up of one or several digits.


Or you could use the AttributeValidator transformer to test if the attribute is numeric.

Test for Type Numeric.


Hi @oliwerurban,

I created a Workspace to test it. The transformer AttributeCreator was used to simulate 3 attributes: Solutial, Solutial11, 11.

After the transformer StringReplacer:

Thanks,

Danilo


You could use the StringSearcher transformer with the regular expression: ^[0-9]*$

(meaning start then only digits then end).

Maybe consider using + rather than * to avoid matching empty values

something wrong with this service?

This post is old, is it not?


something wrong with this service?

This post is old, is it not?

It doesn't look very old to me, at least:

 

 


Try the following in a StringReplacer:

^\d+$

It will only replace the attribute values that are entirely made up of one or several digits.

It works! Thank you very much