DotNetKick.com is an open-source project. Please report any bugs and let us know your great suggestions. Currently running svn revision 620 (rss)

Kick Spy!, Kick Zeitgeist and Kick Widgets

2
kicks
submitted by rimsystems rimsystems 1 year, 2 months ago

code.nontalk.com — I ran into a situation where I needed to screen scrape some content from a site and display it on my own site. This works really well except for dependent files like javascripts, SWFs and images that had src attributes with relative paths. So I figured it wouldn't be that hard to create a helper method to find and replace them using Regular Expressions.

tags: | tag it

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:

Comments:
The code is wrong.

It will not output

img src="http://www.nontalk.com/images/dot.gif, it will output img src="http://www.nontalk.com/mages/dot.gif because it says: match src|href followed by any character that is not h, t, or p. If the url started with h or t or p, the regex wouldn't match at all. I think he wanted a negative lookahead rather than a negated character class. E.g., (?!http)
posted by aquinas 1 year, 2 months ago
good catch! You are right. I updated the code.
posted by nontalk nontalk 1 year, 2 months ago



information Login or create an account to comment on this story
 

Sponsored Link: www.carlist.ie

Search:

Ads via The Lounge