Skip to main content
Question

Can I use String replacer to add a character between two regular expessions?

  • March 2, 2017
  • 1 reply
  • 29 views

Hello,

 

 

I need to reformat some strings.

3/2-A1 needs to become 3/2-A01. Where I have a dash followed by a letter followed by a number I want to replace it by dash, the same letter, 0, then the same number.

I can find my string using a regular expression :

-[A-Z][1-9]

and I've tried -[A-Z]0[1-9] in the Replacement text box of String Replacer but (unsurprisingly that just gives me

3/2-[A-Z]0[1-9]

Is there away to search for the whole regex, but only replace part of it?

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.

1 reply

jdh
Contributor
Forum|alt.badge.img+40
  • Contributor
  • March 2, 2017

text to match: (-[A-Z])([1-9])

 

replacement text: \\10\\2

 

 

putting parentheses around sections creates parts, and then you can refer to the parts as \\1, \\2 etc.