Skip to main content

Hello,

 

 

I'm trying to replace my overdose of RegEx StringReplacers with a single AttributeManager that should contains multiple RegEx functions.

 

 

I've set up a short test:

The first part of the test works fine: change: "world" to "WORLD"

 

The second part doesn't seem to execute: change the "99" to "100"

I'm now wondering:

 

Can the AttributeManager conditional value hold multiple RegEx functions or just one?

 

Thanks,

 

Ed

 

 

 

I think what's happening is that the feature passes through the first IF statement, gets processed (changing world to WORLD) and then doesn't go through the others. Other than putting multiple AttributManagers (or StringReplacers) in a row I don't think there's much you can do about it.

Python could perhaps be an option if you want to run multiple regex replacements on a single attribute.


It's not very pretty or readable but you can do multiple regex replacements within the attributemanager with this sort of syntax

@ReplaceRegEx(@ReplaceRegEx(@Value(text),(World),WORLD),(x0-9]{2}),100)

Hi @edhere, the conditions are evaluated one by one from top to bottom, and the evaluation process finishes when first matches or every not matches. The conditions that match the second or later will not be evaluated forever.

A workaround is to use the two StringReplacers in series, as @redgeographics mentioned.

Alternatively, this single expression could also work as expected. The @ReplaceRegEx function would return the original string if it didn't match the regex. 

@ReplaceRegEx(@ReplaceRegEx(@Value(POI_Name),World,WORLD),/0-9]{2},100)

 


You could try by adding multiple POI_NAME attributes, so with the same name. Each with one test.


Thanks all for your comments.

 

I'm going for the solution by @arnovananrooij- this keeps a nice overview without having to write an extremely long RegEx.

Thanks all for your comments.

 

I'm going for the solution by @arnovananrooij- this keeps a nice overview without having to write an extremely long RegEx.

Good to hear you got a solution.

In addition, you don't need to use conditional value setting here, since the @ReplaceRegEx function would just return the original string if it didn't match the regex.


Reply