RegEx groups not working in studio "Replace All" widget

Trying to use a regex group to replace the matched string doesn’t seem to be working.

e.g. if I wanted to replace all PlaySound(<SOUND_NAME>) with PlaySound(true, <SOUND_NAME>) I should be able to use PlaySound\((.+)\) to match every occurrence and then replace it with PlaySound(true, \1) to get what I wanted.

Reproduction Steps

  • create a script and put this line in it PlaySound('test')
  • use CTRL+Shift+F to open up the studio Find All / Replace All window.
  • enable regular expressions and match the string (while also capturing a group inside the parentheses) using this pattern PlaySound\((.+)\)
  • put PlaySound(true, \1) in the replace field and click “Replace All” button

Expected Behavior
it should use the first regex group (.+) to replace PlaySound('test') with PlaySound(true, 'test')

Actual Behavior
it replaces with an actual “\1” string: PlaySound(true, \1) instead of using the matched regex group
image


It’s worth noting that this actually works in a single script

Issue Area: Studio
Impact: Low
Frequency: Constantly

11 Likes

Annoying. I moved a bunch of constants to a module and I couldn’t use capture groups to replace 75+ references. \1 doesn’t work, $1 doesn’t work, etc.

3 Likes

Surprised this has yet to receive a single reply. It’s things like these that unfortunately push developers away from studio and into external solutions like visual studio code, where features like these are a given instead of something you wait 4 months to maybe get.

Small quality of life features add up into huge issues quickly.

Sorry for the bump, but this really should have a reply by now, and hopefully this reply will cause it.

5 Likes

I guess since this still hasn’t been fixed and I’m currently in need of this, the only alternative is to use search all to find the scripts where the string we want to replace is located,
Screen Shot 2022-10-16 at 12.38.47 PM

and then jumping to there using the FindAll. After which replacing everything within the scripts Search bar.
An extra step but it’s better than nothing

1 Like

Hi everyone!

Sorry for not updating this thread! We are looking into the issue and will update you as soon as we have more information!

Thank you for your patience!

2 Likes

We’ve deployed a fix for this issue, just let us know if you have any questions. Thanks again!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.