So I\'ve got a big text file which looks like the following:
There are two problems with your original solution. Firstly, your example text:
<option value value='1' >A
has two occurences of the "value" word. Your regex does not. Also, you need to escape the opening brace in the quantifier of your regex or Vim will interpret it as a literal brace. This regex works:
:%s/<option value value='.\{1,}' >//g
There is a very simple solution to this unless I have not understood the problem. The following regular expression:
(.*)(>)(.*)
will match the pattern specified in your post.
So, in notepad++ you find (.*)(>)(.*)
and replace it with \3
.
The regular expressions are basically greedy in the sense that if you specify (.*)
it will match the whole line and what you want to do is break it down somehow so that you can extract the string you want to keep. Here, I have done exactly the same and it works fine in Notepad++ and Editplus3.
Here's a nice article on Notepad++ Regular expressions
http://markantoniou.blogspot.com/2008/06/notepad-how-to-use-regular-expressions.html
Notepad ++ : Search Mode = Regular expression
Find what: (.*>)(.)
Replace with: \2
Very simple just Find:
<option value value=.*?>
and Click Replace
This will work. Tested it in my vim. the single quotes are the trouble.
1,$s/^<option value value=['].['] >/