fuzzylogic25 wrote:
> I am trying to strip a bunch of links from a webpages source
> file. I find that whenever a "http://...."; is displayed, it
> ends with a < ..> after it.
> so for example, in source code we might have
> "http://www.google.com <br />".
>
> So what I am trying to do is, copy the link only, to a new
> text file.

All you need is a pattern (regular expression, get the mind-
numbing details at ':help pattern') that finds the URL (or
whatever text you want to copy). Then use the tip that I
mentioned a few posts ago (the CopyMatches script):
http://vim.wikia.com/wiki/Copy_the_search_results_into_clipboard

If anyone has a suggestion for the search pattern, please reply
(a suggestion is below).

Copy the script into a file, say copysearch.vim and save the
file. In Vim, when viewing that file you can enter ':so %' to
source (execute) the script (% = current file). Or, you can
enter ':so copysearch.vim' to directly source it.

In the file with the links, try some searches and see if they
find what you want. For this, you want the search hit to be
highlighted:
http://vim.wikia.com/wiki/Highlight_all_search_pattern_matches

An example search would be the following (type this):

/http:[0-9a-zA-Z?=+._~&/\-]\+

Rather than typing it, you can copy all text after the initial
'/' to the clipboard, then in Vim type (three characters):

/ Ctrl-R +

Then type the following command added by the script and save:

  :CopyMatches
  Ctrl-W n
  "+p
  :w my.txt

Please bottom post on this list. Quote a small (relevant) part
of the message you are replying to, and put your text underneath.
Delete text that is not needed to understand your reply

John

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to