I have a sample text like this:\documentclass[a4paper]{article}\usepackage[a4paper,margin=2cm]{geometry}\usepackage[utf8]{inputenc}\usepackage[T1]{fontenc}\usepackage{color}\setlength{\parindent}{0em}\setlength{\parskip}{2ex plus1ex minus0.5ex}\newcommand{\stylea}[1]{\noindent{\textcolor[rgb]{0.9, 0.9, 0.8}{\fcolorbox[rgb]{0, 0, 0}{0.2, 0.2, 0.2}{#1}}}}\begin{document}\ttfamily\setlength{\fboxrule}{0pt}\setlength{\fboxsep}{0pt}1 \stylea{\# Author{\hspace*{1em}}: Bhishan Poudel} \\2 \stylea{\# Date{\hspace*{1em}}{\hspace*{1em}}: May 19, 2016} \\3 \stylea{} \\4 \stylea{Line wrapping in geany} \\5 \stylea{===============================================================================} \\6 \stylea{edit > preference > editor > features > line wrapping} \\7 \stylea{then,} \\8 \stylea{document > line wrapping} \\\end{document}I want to delete all the words \stylea{  }keeping the words inside {} intact.I know i can find and replace \stylea{  and replace by whitespace,but i don't even want whitespace and also want to delete closing brace }at the same time.Also can we replace words in only selected block in geany?e.g. if I select the lines 1 to 8, and replace stylea by styleb?Thanks in advance!
how to find and delete certain regex in geany text editor?
regular expression;replace;geany
Replacing with GrepYou can do (most of) this with regular expression search/replace.Use the Replace dialog, making sure that Use Regular Expressions is selected and Use multi-line matching is not.Search for:\\stylea{(.*)}And replace with:\1This is a regular expression back reference to the captured text in the search expression (the portion inside the parentheses).  If you had multiple captures, you could refer to them with \1, \2, etc.However, keep in mind that there is a limitation on regular expressions that is likely to cause you some grief.  You have some lines where you have curly braces nested inside the text, such as:\stylea{\# Date{\hspace*{1em}}{\hspace*{1em}}: May 19, 2016}Regular expressions can't (by themselves) count and match nesting delimiters ({}) like this.  In your case, this may not end up being a practical problem because the (.*) capture will match as many characters as it can before the end of the line (greedy matching), which in your sample text happens to do the right thing, because each \stylea{} tag is on one line.  If you do have files with \stylea{} tags spanning multiple lines, this method will not replace the text properly.  Your best option may be to find those instances first and either change them by hand or make sure they don't span multiple lines.This should work with many editors that offer regular-expression search/replace, though the details of the dialog options of course will vary.  I tested it on TextWrangler for Mac OS X.Replacing only in selectionSelect the 8 numbered lines.  Search for:\\stylea{And replace with:\\styleb{Then click the In Selection button in the Replace dialog.