Skip to main content
Solved

Attempting to combine mulitple string replacements in attribute manager text editor

  • February 13, 2024
  • 5 replies
  • 219 views

stephen.bosse11
Participant
Forum|alt.badge.img+1

@ReplaceRegularExpression(@Value(DETAILS),<.+?>,,caseSensitive=FALSE), @ReplaceString(@Value(DETAILS),&qout;,",caseSensitive=TRUE)

 

The first expression replaces any text in details attribute that is bracketed with <> to be deleted.

the second expression replaces any instance where &qout; appears with “.

These work fine as separate transformations, however when trying to lump them into a single statement in attribute manager’s text editor the transform fails.

I’ve tried comma separating, spacing, and barring the functions, but have had no luck. Any suggestions on how to get this to run?

 

Thanks!

Best answer by dustin

@ReplaceRegularExpression(@ReplaceString(@Value(DETAILS),&qout;,"\"",caseSensitive=TRUE),<.+?>,,caseSensitive=FALSE)

Try this. If you want to string together multiple operations in a AttributeManager, you have to nest the operations. It won’t work by comma separating them. Also, the double quote you want to replace with will need to be escaped using \, and also placed in double quotes itself.

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

dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • Best Answer
  • February 13, 2024
@ReplaceRegularExpression(@ReplaceString(@Value(DETAILS),&qout;,"\"",caseSensitive=TRUE),<.+?>,,caseSensitive=FALSE)

Try this. If you want to string together multiple operations in a AttributeManager, you have to nest the operations. It won’t work by comma separating them. Also, the double quote you want to replace with will need to be escaped using \, and also placed in double quotes itself.


stephen.bosse11
Participant
Forum|alt.badge.img+1

Hi dustin, after running that I get this error

ERROR |AttributeManager_8: Unable to find closing bracket for function 'ReplaceRegularExpression' in '@ReplaceRegularExpression(@ReplaceString(@Value(DETAILS),&qout;,"\"",caseSensitive=TRUE),<.+?>,,caseSensitive=FALSE@ReplaceRegularExpression(@ReplaceString(@Value(DETAILS),&qout;,"\"",caseSensitive=TRUE),<.+?>,,caseSensitive=FALSE)'


dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • February 13, 2024

Hi dustin, after running that I get this error

ERROR |AttributeManager_8: Unable to find closing bracket for function 'ReplaceRegularExpression' in '@ReplaceRegularExpression(@ReplaceString(@Value(DETAILS),&qout;,"\"",caseSensitive=TRUE),<.+?>,,caseSensitive=FALSE@ReplaceRegularExpression(@ReplaceString(@Value(DETAILS),&qout;,"\"",caseSensitive=TRUE),<.+?>,,caseSensitive=FALSE)'

Maybe I’m reading it wrong, but it looks like you copied the string in twice? There are two @ReplaceRegularExpressions in that error.


stephen.bosse11
Participant
Forum|alt.badge.img+1

And if I wanted to add a third function? for example:

@ReplaceRegularExpression(@ReplaceString(@Value(DETAILS),&quot;,"\"",caseSensitive=TRUE),@ReplaceString(@Value(DETAILS),&amp;,"\&",caseSensitive=TRUE),<.+?>,,caseSensitive=FALSE)


dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • February 13, 2024

And if I wanted to add a third function? for example:

@ReplaceRegularExpression(@ReplaceString(@Value(DETAILS),&quot;,"\"",caseSensitive=TRUE),@ReplaceString(@Value(DETAILS),&amp;,"\&",caseSensitive=TRUE),<.+?>,,caseSensitive=FALSE)

Yes, you would just keep nesting the new function into the location of @Value(DETAILS). Although in this case, you shouldn’t need the quotes and the escape \ before the ampersand (I don’t think)

@ReplaceRegularExpression(@ReplaceString(@ReplaceString(@Value(DETAILS),&amp;,"\&",caseSensitive=TRUE),&qout;,"\"",caseSensitive=TRUE),<.+?>,,caseSensitive=FALSE)