Author |
Topic  |
|
JJenson
Advanced Member
    
USA
2121 Posts |
Posted - 26 August 2007 : 12:41:43
|
I am trying to figure out how to convert automatically using regext a url that looks like this.
www.vmcplugins.com
into something that will display on an page as a link. I cannot figure out how I would write this to have it parse out correctly. THis is how I am using regex with other fields.
PreSubmit2 = REPLACE(PreSubmit2,vbcrlf,"<br>") 'Put Spaces into post.
THanks I just can't get it to work for me Big surprise huh? lol |
|
HuwR
Forum Admin
    
United Kingdom
20595 Posts |
Posted - 26 August 2007 : 12:59:43
|
download the .Net version and have a look in the formatting.cs file, one of the rgex's in the replaceurls function will do what you need, it is very similar in asp to .net so should be easy to convert it.
by the way PreSubmit2 = REPLACE(PreSubmit2,vbcrlf,"<br>") 'Put Spaces into post. is not a regexp, it is just a standard text replace 
|
 |
|
JJenson
Advanced Member
    
USA
2121 Posts |
Posted - 26 August 2007 : 13:03:07
|
lol oh
Well I will have a look cause I need to have some regex for formating url's
Thanks HuwR
Sometimes I am not so good with calling things how they should be but learning. |
 |
|
JJenson
Advanced Member
    
USA
2121 Posts |
Posted - 26 August 2007 : 13:14:28
|
IS this the line of code you were talking about HuwR?
|
 |
|
HuwR
Forum Admin
    
United Kingdom
20595 Posts |
Posted - 26 August 2007 : 14:14:28
|
there several , would probably try this one matchstring = @"((((?<!]|\x22)https?)://)([\d\w\-]+\.)?([\w\d\-\.]+\.[\w\d]+)((/ [\w\d\.\-@%\\\/:(),]*)+(\? [\w\d\?%,\.\/\#!@:=\+~_\-&]*)?)?(?<![\.]))"; fString = Regex.Replace(fString, matchstring, "<a href='$1'>$4$5</a>", RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
depends what exactly you want to do with it. Check out this site http://www.radsoftware.com.au/ they have some good stuff about regexp's and a tool you can download to test with. |
 |
|
JJenson
Advanced Member
    
USA
2121 Posts |
Posted - 26 August 2007 : 14:23:05
|
Basically what I want to do is what this site does when someone enters a url then once posted it turns into a clickable link. |
 |
|
JJenson
Advanced Member
    
USA
2121 Posts |
Posted - 26 August 2007 : 16:14:27
|
Hey Huw I have been trying to get that line to work and I have no idea on how to that that included into this function. I have taken it out and this is what I am starting with:
Can you give me a little more guidance on how I would go about implementing the sbove line into this funtion?
THanks
|
Edited by - JJenson on 26 August 2007 16:17:28 |
 |
|
|
Topic  |
|
|
|