Skip to main content
Solved

Select AND Replace with a RegEx Expression

  • May 25, 2018
  • 3 replies
  • 696 views

Forum|alt.badge.img

Hello,

 

 

I have an attribute that has values like this (the attribute itself is RegEX expression):

^[1-9]{1}[0-9]{1-3}[1-9]{1}[0-9]{5-7}$

In this attribute I want to replace all - that are within {} with a ,

 

 

I tried using the String replacer by first selecting all curly brackets with dashes, like this :

\\{\\d-\\d\\}

And then replacing it with this:

\\{\\d,\\d\\}

But of course it does not work cause you cannot replace with regex.

 

 

Any ideas?

 

 

Thanks !

 

Best answer by gio

@draganasubotic1

You can use stringreplacer, Replace Regular Expression.

regexp:

({[\\d])-([\\d]})

and replacement

\\1,\\2

Everything between brackets is a capture, of which there are 2 in this case.

Captures can be referred to by slashes, \\1 is first capture.

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.

3 replies

denizturan1985
Participant
Forum|alt.badge.img

I guess you want to replace all dashes which are in the curly brackets with "," (comma).

You can use the expression below:

(?<=\{\d)\-

0684Q00000ArJlNQAV.jpg


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • Best Answer
  • May 25, 2018

@draganasubotic1

You can use stringreplacer, Replace Regular Expression.

regexp:

({[\\d])-([\\d]})

and replacement

\\1,\\2

Everything between brackets is a capture, of which there are 2 in this case.

Captures can be referred to by slashes, \\1 is first capture.


Forum|alt.badge.img

Thanks a lot, both answers were very helpful!