Skip to main content
Inspiring
October 20, 2023
Answered

GREP to add space in specific query

  • October 20, 2023
  • 1 reply
  • 319 views

Hey there. I could use some help with a simple GREP I can use in Find/Replace to add a space after a an x, where it appears after a digit in a quantity. For example

2x 50L

should be 2 x 50L

 

Not worked out how to do it, I can of course use the wildcard option to find all (digit)x but can't replace them in that way as the digit varies. Thanks.

This topic has been closed for replies.
Correct answer jmlevy

Hi @defaults2aq0czkx4gl you write: Find/Replace to add a space after a an x but your example seems that you want a space before the x.

Find what: (?<=\d)x

Replace: ~Sx

 

Please note that I advise you to use a nonbreaking (~S) space instead of a “regular” space (\s)

1 reply

jmlevy
Community Expert
jmlevyCommunity ExpertCorrect answer
Community Expert
October 20, 2023

Hi @defaults2aq0czkx4gl you write: Find/Replace to add a space after a an x but your example seems that you want a space before the x.

Find what: (?<=\d)x

Replace: ~Sx

 

Please note that I advise you to use a nonbreaking (~S) space instead of a “regular” space (\s)

Inspiring
October 20, 2023

Perfect, thanks very much. Yes sorry, I meant a space before the x.