473,385 Members | 1,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

extract UNC path using regular expression

ksr
Hi,
I am looking for a regular expression that would extract UNC paths from a
given string and place that inside a href.
Currently the expression fails if there is a space in the path..

eg. \\server\my doc.doc

is there a regular expression to do this?

TIA,
ks
Nov 18 '05 #1
3 6010
"ksr" <k_*******@nospam.hotmail.com> wrote in news:OV94Tn0cEHA.556
@tk2msftngp13.phx.gbl:
I am looking for a regular expression that would extract UNC paths from a
given string and place that inside a href.
Currently the expression fails if there is a space in the path..
eg. \\server\my doc.doc
is there a regular expression to do this?


Regexps are not magic. If you have a string like "Jake, read the docs in
\\server1\code documentation\coolproject for windows and its
subdirectories", it's impossible to make a reasonable guess on where the
UNC path might end.

So, if you can come up with the logic first, then you can ask for a regexp
representation.
--
Jouni Heikniemi, jo********@heikniemi.net
http://www.heikniemi.net/hc/ (blog)
Nov 18 '05 #2
ksr
Thnaks for the reply. This is what the requirement is.. There is a multiline
textbox and users can enter some text and UNC path. If there is space
between the words inside path then the path will be enclosed in <path goes
here> . I am new to regular expressions and looking for some help in this
regard.

Hope this clears the logic part of it. Please help me with this

Appreciate your help

TIA

"Jouni Heikniemi" <jo********@heikniemi.net> wrote in message
news:Xn**********************************@127.0.0. 1...
"ksr" <k_*******@nospam.hotmail.com> wrote in news:OV94Tn0cEHA.556
@tk2msftngp13.phx.gbl:
I am looking for a regular expression that would extract UNC paths from a given string and place that inside a href.
Currently the expression fails if there is a space in the path..
eg. \\server\my doc.doc
is there a regular expression to do this?


Regexps are not magic. If you have a string like "Jake, read the docs in
\\server1\code documentation\coolproject for windows and its
subdirectories", it's impossible to make a reasonable guess on where the
UNC path might end.

So, if you can come up with the logic first, then you can ask for a regexp
representation.
--
Jouni Heikniemi, jo********@heikniemi.net
http://www.heikniemi.net/hc/ (blog)

Nov 18 '05 #3
"ksr" <k_*******@nospam.hotmail.com> wrote in
news:uY**************@TK2MSFTNGP12.phx.gbl:
in <path goes here> . I am new to regular expressions and looking for
some help in this regard.
Hope this clears the logic part of it. Please help me with this


Read a tutorial, it'll help you in the future.
<http://www.regular-expressions.info> is a decent one.

Try this for a regexp: (?:<(\\\\[-\d\w\\\s]+?)>)|(\\\\[-\d\w\\]+)

It should capture the UNCs you want. Note that if you put it into a C#
string, you need to double all backspaces (yes, there are quite a few of
them then).
--
Jouni Heikniemi, jo********@heikniemi.net
http://www.heikniemi.net/hc/ (blog)
Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jay Douglas | last post by:
Hello all. I'm having a hard time coming up with a regular expression that can extract just the numbers out of string into a GroupCollection. Any help is appreciated.
3
by: jarod1701 | last post by:
Hi, I'm currently trying to create a regular expression that can extract certain elements from a url. The url will be of the following form: http://user:pass@www.sitename.com I want a...
7
by: teo | last post by:
hallo, I need to extract a word and few text that precedes and follows it (about 30 + 30 chars) from a long textual document. Like the description that Google returns when it has found a...
9
by: trihanhcie | last post by:
Hi, I would like to extract the text in an HTML file For the moment, I'm trying to get all text between <tdand </td>. I used a regular expression because i don't know the "format between...
6
by: Dave | last post by:
Hope someone can help! I have a memo fiels in which there are a few numbers including dates but what I want to do is extract a number which is 6 figures long. Can anyone help me? Thanks Dave
1
by: maverickx | last post by:
Hi everyone, this is about my one project, i was planning to do like this: Firstly i printed out the source code of one html page on the DOS window, and then use PERL Regular Expression to extract...
20
by: kosanovic | last post by:
Hello, I'm bad at regular expressions. Would somebody help me: I need to extract all URL to .jpg and .png pictures from a string containing an HTML file (DOM wouldn't work well in what I need). ...
3
by: suzanne.boyle | last post by:
Hi I have an html file with headings followed by one or more paragraphs like this <h2>blah blah 1</h2> <p>more blah blah blah</p> <h2>blah blah 2</h2> <p>more blah blah blah</p>
3
rizwan6feb
by: rizwan6feb | last post by:
I am trying to extract php code from a php file (php file also contains html, css and javascript code). I am using the following regex for this <\?*?\?> but this doesn't cater quotation marks...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.