BBEdit regex replace only works when using "Replace All"

94 Views Asked by At

Looking to replace all examples like this:

"1%"

"10%"

with:

"1.0%"

"10.0%"

Here is my regex:

"(\d+)%"

And here is my replace pattern:

"\1\.0%"

If I click "Replace" I get this error:

The replacement string couldn’t be computed, because the previous Grep search did not succeed (application error code: 12003). The replacement string couldn’t be computed, because the previous Grep search did not succeed (application error code: 12003).

However, if I click "Replace All," it works.

I'm guessing this is my error, as this is a very basic task. What am I doing wrong?

1

There are 1 best solutions below

1
hitesh bedre On

You can try regex as: (\d+)%

And replace pattern as: $1.0%

Here is demo: https://regex101.com/r/E3M4k5/1

or

You can try regex as: (\d+)

And replace pattern as: $0.0

Here is demo: https://regex101.com/r/nM2rAq/1