| Computers Forum Index » Computer - Editors » [vim]substitutions in specified multiline areas... |
|
Page 1 of 1 |
|
| Author |
Message |
| Erhy... |
Posted: Thu Jun 25, 2009 2:19 pm |
|
|
|
Guest
|
Hello,
I want to substitute attributes in certain html tags.
How to do
if I specify tags e.g.:
?<\a\+\d*\_s\+\_.\{-}>?
and then I want to substitute in this multiline areas e.g.
s?\<id\>\_s*=\_s*"\a[0-9A-Za-z_\-:.]*"??
Thank you for a tip
Erhy |
|
|
| Back to top |
|
|
|
| Christian Brabandt... |
Posted: Thu Jun 25, 2009 11:53 pm |
|
|
|
Guest
|
On 2009-06-25, Erhy <erhard> wrote:
Quote: How to do
if I specify tags e.g.:
?<\a\+\d*\_s\+\_.\{-}>?
and then I want to substitute in this multiline areas e.g.
s?\<id\>\_s*=\_s*"\a[0-9A-Za-z_\-:.]*"??
untested:
:g/<\a\+\d*\_s\+\_.\{-}>/s?\<id\>\_s*=\_s*"\a[0-9A-Za-z_\-:.]*"??
regards,
Christian
--
hundred-and-one symptoms of being an internet addict:
253. You wait for a slow loading web page before going to the toilet. |
|
|
| Back to top |
|
|
|
| Erhy... |
Posted: Fri Jun 26, 2009 11:35 pm |
|
|
|
Guest
|
"Christian Brabandt" <cb-news at (no spam) 256bit.org> schrieb im Newsbeitrag
news:4a43d5d0$0$31865$9b4e6d93 at (no spam) newsspool3.arcor-online.net...
Quote: On 2009-06-25, Erhy <erhard> wrote:
How to do
if I specify tags e.g.:
?<\a\+\d*\_s\+\_.\{-}>?
and then I want to substitute in this multiline areas e.g.
s?\<id\>\_s*=\_s*"\a[0-9A-Za-z_\-:.]*"??
untested:
:g/<\a\+\d*\_s\+\_.\{-}>/s?\<id\>\_s*=\_s*"\a[0-9A-Za-z_\-:.]*"??
regards,
Christian
--
Thank you Christian,
I elected this command:
:%s?\(<\a\+\d*\_s\_[^>]\{-}\)\(id\_s*=\_s*"\a\w*"\_s*\)\(\_[^>]*>\)?\1\3?
I struggled, because I tried with "\&"
But "\&" is not a logical AND.
Good luck
Erhy
PS. your proposal doesn't function, if white space comes with line feed. |
|
|
| Back to top |
|
|
|
|