title: Need help to make a RegExp filter to replace redundant Parentheses
body: <p>For the past few days (weeks, months, years maybe if you count my on-again off-again search and attempts) I've been trying to make or find a RegEx filter to help me remove all redundant parentheses found in my code.</p>
  <p>A worst case scenario of what the regex filter will have to deal with is attached. As is a best case scenario</p>
  <blockquote>
  <p>return ((((((((((((((((((((((((((getHumanReadableLine(&quot;avHardwareDisable&quot;) + getHumanReadableLine(&quot;hasAccessibility&quot;)) + getHumanReadableLine(&quot;hasAudio&quot;)) + getHumanReadableLine(&quot;hasAudioEncoder&quot;)) + getHumanReadableLine(&quot;hasEmbeddedVideo&quot;)) + getHumanReadableLine(&quot;hasIME&quot;)) + getHumanReadableLine(&quot;hasMP3&quot;)) + getHumanReadableLine(&quot;hasPrinting&quot;)) + getHumanReadableLine(&quot;hasScreenBroadcast&quot;)) + getHumanReadableLine(&quot;hasScreenPlayback&quot;)) + getHumanReadableLine(&quot;hasStreamingAudio&quot;)) + getHumanReadableLine(&quot;hasStreamingVideo&quot;)) + getHumanReadableLine(&quot;hasTLS&quot;)) + getHumanReadableLine(&quot;hasVideoEncoder&quot;)) + getHumanReadableLine(&quot;isDebugger&quot;)) + getHumanReadableLine(&quot;language&quot;)) + getHumanReadableLine(&quot;localFileReadDisable&quot;)) + getHumanReadableLine(&quot;manufacturer&quot;)) + getHumanReadableLine(&quot;os&quot;)) + getHumanReadableLine(&quot;pixelAspectRatio&quot;)) + getHumanReadableLine(&quot;playerType&quot;)) + getHumanReadableLine(&quot;screenColor&quot;)) + getHumanReadableLine(&quot;screenDPI&quot;)) + getHumanReadableLine(&quot;screenResolutionX&quot;)) + getHumanReadableLine(&quot;screenResolutionY&quot;)) + getHumanReadableLine(&quot;version&quot;)));</p>
  <blockquote>
  <p>return ((((name + &quot;: &quot;) + Capabilities[name]) + &quot;\n&quot;));</p>
  </blockquote>
  </blockquote>
  <p>As you can see there's... a few... redundant parentheses in my code. Been working actively with these for a very long time but have always tried to clean up what I come across and been trying to find a faster way to do it.</p>
  <p>So one example of how the &quot;clean&quot; code would look, I'm hoping at least!</p>
  <blockquote>
  <p>return (name + &quot;: &quot;  + Capabilities[name]  + &quot;\n&quot;);</p>
  <blockquote>
  <p>return name + &quot;: &quot;  + Capabilities[name]  + &quot;\n&quot;;</p>
  </blockquote>
  </blockquote>
  <p>Either one is acceptable to be completely honest as long as the code itself doesn't mock up and change how it works.</p>
  <p>I greatly appreciate any answers anyone can give me. Please don't Mock what I do or am trying to achieve. I haven't worked much with regex or similar things before...</p>
  <p>And just to humour you... Here's my &quot;RegExp&quot; for my &quot;clean&quot; example</p>
  <blockquote>
  <p>(return) ({1,}((.[^)]{1,}))(.{1,}))(.{1,})){1,}</p>
  <blockquote>
  <p>$1 $2 $3 $4 // output</p>
  </blockquote>
  </blockquote>
  <p>oh... Forgot to mention</p>
  <blockquote>
  <p>(!(testCrossZ()))</p>
  </blockquote>
  <p>Might appear at times as well but those aren't as big of an issue to clean up manually if needed.</p>
  <p>P.S... There is a &quot;LOT&quot; of occurances of the redundant parentheses... Like... Maybe thousands... Most likely thousands.</p>