I have the page source of a website but the links that I need are clumped together. How do I separate each link, one link per line, if they all start with href?
|
There are several ways to do it. For example, you can write a small program or script to do the work, or use a text editor capable of formatting HTML, or one that can do a search/replace using regular expressions.
I'll show you the last two options, using jEdit ( Auto format the HTML textYou'll need one of the "Beauty" or "XML" plugins for jEdit. In jEdit, go to "Plugins" -> "Plugin Manager...", tab "Install", check "Beauty" or/and "XML", click button "Install". If you now go to the tab "Manage", the plugin(s) should be listed there. To use Beauty, you'll need to make sure that the html formatter is selected. Go to "Plugins" -> "Plugin Options...". In the left tree, open "Plugins"/"Beauty"/"Modes". In the right list, select Beautifier html:beauty for Mode html. Or, to use XML, just go to "Plugins" -> [initials] -> "XML" -> "Indent XML". Search/replace using regular expressionsLoad your file in jEdit, press Ctrl+F to open the "Search And Replace" dialog and change the options so that it looks like this:
That is: Search for: I tested the replace with:
Which resulted in:
|
||||
|


