Skip to main content
Question

ReplaceRegEx with another regExp with Text Editor


Forum|alt.badge.img

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

5 replies

lars_de_vries
Forum|alt.badge.img+10
Is it correct to assume that the output of the first string should be '7. Street'?

 


david_r
Evangelist
  • March 27, 2018

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.


david_r
Evangelist
  • March 27, 2018
Generally speaking, I would recommend posting each question separately.

Forum|alt.badge.img
lars_de_vries wrote:
Is it correct to assume that the output of the first string should be '7. Street'?

 

I corrected it. thank you @lars_de_vries

 

 


lars_de_vries
Forum|alt.badge.img+10

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.


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