Find and replace regex and use result in replace


#1

I’m attempting to find and replace $_GET[’[^’]+’] with ($1) but it literally replaces with (1) rather than (_GET[’’])

Can Atom handle this kind of find and replace?


#2

You have no capture so there is no first thing to be replaced by $1. Also, the first bracket has no matching end bracket. I think you meant to use \[.

Try https://www.myregextester.com/index.php#highlighttab.


#3

\$_GET\['[^']+'\]

I think it copied weird maybe. This is what I’m using.

A capture group is ()? so (\$_GET\['[^']+'\])? Not exactly familiar with regex.


#4

Yes. Good luck …


#5

Got it.

(\$_GET\['[^']+'\])

with

($1)