title: Difficulties with adding spaces around equal signs using regular expressions with Notepad++
body: <p>I am currently trying to improve the readability of some of my python scripts by adding 
  spaces around the equal signs. For example, currently an assignment looks like this:</p>
  
  <pre><code>foo=4
  bar[index]=4
  </code></pre>
  
  <p>and I want to change it to:</p>
  
  <pre><code>foo = 4
  bar[index] = 4
  </code></pre>
  
  <p>I've already found the following answered question <a href="https://stackoverflow.com/questions/19714748/notepad-search-and-replace-with-regular-expression/19714786#19714786">Notepad++: Search and Replace with Regular Expression</a> which suggests that using the following regex in "find what" should work:</p>
  
  <pre><code>(?&lt;=[\w\]\)])=(?=\w)
  </code></pre>
  
  <p>Notepad++ correctly finds all corresponding equal signs, but it doesn't replace them, no matter what I try to replace them with. I am now using:</p>
  
  <pre><code>([\w\]\)])=(\w)
  </code></pre>
  
  <p>in "find what" together with:</p>
  
  <pre><code>\1 = \2
  </code></pre>
  
  <p>in "replace with", which does the job. However, I don't understand why the initial regex doesn't work, especially as it (well, something equivalent to it) is marked as correct in the linked question. It doesn't work in either Notepad++ 6.6.1 or 6.6.8. I am not very familiar with regular expressions and this is the first time that I am using them in Notepad++, so I would appreciate any help.</p>
  
  <p>Edit:
  To clarify: I didn't leave the "replace with" field empty in any of my attempts, but always filled it with something, either with <code>=</code> or some other string. For my initial regex, I didn't use <code>\1 = \2</code> . </p>
  
  <p>But I think I have identified the problem. I've tried all the suggestions so far, but none of them seemed to work. But as soon as I clicked on "replace all" instead of "replace", Notepad++ did replace everything correctly, even with my initial regex. I am not sure if this is the intended behaviour.</p>