Skip to main content

Hello all,

I have two questions. 

1- Is it possible to replace regex with a regex? For example, I want to add a dot after every numeric value before any letter. 

 StringBeforeAfter 1

 

7 St7. Street21 Av1. Avenue

@ReplaceRegEx(@Value(POI_NEW_NAME),^\d\s\w,^\d\.s\w,))
Search: ^\d\s\w
Replace: ^\d\.\s\w

2- I have different variations which I need to manipulate. Is there any possibility to use different expressions in a text editor of an AttributeManager? I tried to use "|" symbol for this purpose but it didn't work.

@ReplaceRegEx(@Value(POI_NEW_NAME),^\d\s\w,^\d\.s\w,))|
@ReplaceRegEx(@Value(POI_NEW_NAME),\d$,$\d\.))

Sorry, if it's a duplicate question but I couldn't find a similar case.

Thank you

Is it correct to assume that the output of the first string should be '7. Street'?

 


Try the following in a StringReplacer:

0684Q00000ArJwQQAV.png

Or using an expression:

@ReplaceRegEx(@Value(String),"^(\d+)\s","\1. ")

Remark how we're using double quotes around the regular expressions since they contain certain special characters.

It won't convert "St" to "Street" for you, however.


Generally speaking, I would recommend posting each question separately.
Is it correct to assume that the output of the first string should be '7. Street'?

 

I corrected it. thank you @lars_de_vries

 

 


If you want to nest expressions in the AttributeManager, you could use the example below:

@ReplaceRegEx(@ReplaceRegEx(@ReplaceRegEx(@Value(before),^(\d+),\1.),(St)$,\1reet),(Av)$,\1enue)

If you want to test different versions, you could use a Conditional Statement in the AttributeManager to test first and use a different ReplaceRegEx string depending on the test result.


Reply