Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regex replace pattern - advanced find plugin for Gedit

Tags:

regex

gedit

I'm trying to replace all instances of

$offer->variablenames

with

$offer['variablenames']

Is this possible? I'm using advanced find plugin for gedit.

It's just heiroglyphs to me... Would very much appreciate help.
Thanks

like image 610
Andreas Larsson Avatar asked Feb 16 '12 17:02

Andreas Larsson


People also ask

How do you find and replace in gedit?

Open the Replace tool by clicking Menu button ▸ Find and Replace… or press Ctrl + H . Enter the text that you wish to replace into the Find field. Enter the new, replacement text into the Replace with field.

Can you use regex in Find and Replace?

Regex can be used to perform various tasks in Python. It is used to do a search and replace operations, replace patterns in text, check if a string contains the specific pattern.

How replace text using regex explain with example?

To use RegEx, the first argument of replace will be replaced with regex syntax, for example /regex/ . This syntax serves as a pattern where any parts of the string that match it will be replaced with the new substring. The string 3foobar4 matches the regex /\d. *\d/ , so it is replaced.


1 Answers

Find what:

\$offer\-\>([a-zA-Z0-9_]*)

Replace with:

$offer['\1']

Make sure to have Regular expression checkbox checked.

like image 172
Alex Avatar answered Oct 27 '22 02:10

Alex