Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime text regex find and replace

In sublime text, I need to replace all instances of:

rs('???????')

with

$rs['??????']

(keeping the ??????? part the same). I'm a regex virgin and I've only got as far as locating the regex button on the find and replace panel.

How is this possible.

like image 248
Fraser Avatar asked Jul 12 '13 15:07

Fraser


People also ask

How do I find and replace in Sublime Text?

To use Find and Replace in Sublime Text 3, you can either click “Find” in the top-bar, then select “Replace” from the list, or you can press the keyboard shortcut Ctrl+H – the same way it works in, for example, Microsoft Office Word.

Does Sublime Text support regex?

Search functions in Sublime Text support regular expressions, a powerful tool for searching and replacing text. Regular Expressions find complex patterns in text.

How does regex replace work?

The REGEXREPLACE( ) function uses a regular expression to find matching patterns in data, and replaces any matching values with a new string. standardizes spacing in character data by replacing one or more spaces between text characters with a single space.

How do you use wildcards in regex?

In regular expressions, the period ( . , also called "dot") is the wildcard pattern which matches any single character. Combined with the asterisk operator . * it will match any number of any characters.


1 Answers

Find regex:

rs\('(.*?)'\)

Replace:

$rs['$1']

Beware that this will expect anything inside the quotes; if it isn't what you need, please tell me :)

like image 79
gustavohenke Avatar answered Sep 20 '22 07:09

gustavohenke