Regexp to search and replace HTML in Geany
Question
I have a long list of countries like this :
<option value="Afghanistan" >Afghanistan</option>
<option value="Afrique du Sud" >Afrique du Sud</option>
<option value="Albanie" >Albanie</option>
And I'd like to cut out all the HTML code, so that I'm left with :
Afghanistan
Afrique du sud
Albanie
I'm using Geany, which allows me to use Regexp expressions in my search and replace terms. What expressions can I use for that ?
Solution
If all the lines are formatted just as in your example, you can search separately for <option [^>]*>
and </option>
and replace them with an empty string. Just be careful to select only your country list when doing the find-and-replace or the regex may go wild and replace unintended strings.
OTHER TIPS
See Regular Expressions in Geany Manual
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow