Help with using regular expressions in find & replace

I used AS3toHX to convert actionscript code to hexe code, My main problem with it is that it removes a lot of spaces which I want to restore.

For example I want to replace the = in x=3 with " = " to give x = 3.

Using \w=\w in Find will find all case of an = bracketed by alphanumeric characters.

What do I enter in Replace so that only the = is replaced, not the characters bracketing it?

Thanks in advance!

Have you tried capturing those characters?
$1 = $2

That worked thanks. Didn’t know about capturing characters.

You can capture any group: for example if you wanted to capture all of those things:

a =b;
a= b;

You can use
(\w ?)=( ?\w) (character + optional space)=(optional space + character)
$1 = $2

Sorry that doesn’t work. For a =b and a= b, single spaces become double spaces.

Yeah, you don’t want to capture the space. Search for this instead: (\w) ?= ?(\w)