Skip to main content
Question

ReplaceRegEx with another regExp with Text Editor

  • March 27, 2018
  • 5 replies
  • 62 views

denizturan1985
Participant
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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, 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.

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
Celebrity
  • 8394 replies
  • 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
Celebrity
  • 8394 replies
  • March 27, 2018
Generally speaking, I would recommend posting each question separately.

denizturan1985
Participant
Forum|alt.badge.img
  • Author
  • Participant
  • 11 replies
  • March 27, 2018
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.