-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Jason Holt wrote:
| On Tue, 13 Jul 2004, Daniel Crookston wrote: | | |>Cool. So how do I do a non-greedy wildcard inside them? :%s/<.*>//g |>doesn't just strip out tags, it strips tags and everything inside of them |>too. | | [...] | | Actually, a (normal) greedy match would turn "<b><i>foo</i></b>" into "". | Single-line-matching is the only reason why it doesn't snip everything from | the first < to the last > in your whole file. Non-greedy matches aren't | trivially implementable for the general case in a greedy regex, which is why | they have to be added to the language (that is, they're not just syntactic | sugar). But in your case, %s/<[^>]*>//g should do the trick. | | -J
Except that by my investigating, I couldn't get character classes to
work either (that was the first thing I tried, and is what I would do in
a fully posix regex language, like perl). My other post has the answer
where \{-} is like * but non-greedy. Had to dig through :help pattern to
find that one...Jacob
- -- "Concern for man and his fate must always form the chief interest of all technical endeavors ... Never forget this in the midst of your diagrams and equations." - Einstein -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFA9E5glzgpdZsoHrcRAq0PAJ9YURamT1765YpODIgsN8JC3sv1nQCgnsG0 nd8tlY7dik24vRuVYh5XsEo= =5RyJ -----END PGP SIGNATURE-----
____________________
BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
