I’m trying to write some javascript which executed will search the html for all network locations listed (eg. \\server\file) and convert them to a hyperlink (eg. <a href="\\server\file">\\server\file</a>)
I’m a bit stumped on how to do this, I’ve done some searching but haven’t really found anything suitable. I assume I should be using regular expressions.
Anybody able to help. I must admit I am very much a newb when it comes to regular expressions
This answer to How do I select text nodes with jQuery? is a good start. Your approach would basically be to get all of the text nodes in your document, search for your file pattern, and replace with the hyperlinks.
Sample (you might want tweaking to strip trailing punctuation from match):