regex

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
11 posts Page 1 of 2
Contributors
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

regex
Dummy1912
hello,

hope somebody can help me out it drives me goofy;

i need to make from (call: codenstuff) a url

even #CodenStuff send me to some regex websites but no idea why it don't work
Code: Select all
dim ss = New Regex("\b(?<call>[a-zA-Z_0-9.-]+\w+)\b")
Code: Select all
        s = ss.Replace(s, "<a href=""${call}"" title=""Call me"" "">Call ${call}'here only the name without call:</a>")
i write:
i have to call: codenstuff at once.

so i want it to looks like this
i have to Call codenstuff at once
so the url contains: call: codenstuff

anyone please cryer;
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
XTechVB
VIP - Site Partner
VIP - Site Partner
Posts: 727
Joined: Thu May 20, 2010 10:32 am

Re: regex
XTechVB
Try this Regex
Code: Select all
call:?\W\S*
You can find me on Facebook or on Skype mihai_92b
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: regex
Dummy1912
?? whats the complete regex? #XTechVB

i tried:
Code: Select all
New Regex("\b(?<call>\W\S*)\b")
but only showed call
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
XTechVB
VIP - Site Partner
VIP - Site Partner
Posts: 727
Joined: Thu May 20, 2010 10:32 am

Re: regex
XTechVB
Dummy1912 wrote:
?? whats the complete regex? #XTechVB

i tried:
Code: Select all
New Regex("\b(?<call>\W\S*)\b")
but only showed call
Just a basic example
Code: Select all
        Dim Rgx As Regex = New Regex("call:?\W\S*")
        For Each RgMatch As Match In Rgx.Matches(TextBox1.Text)
            MessageBox.Show(RgMatch.Value)
        Next
You can find me on Facebook or on Skype mihai_92b
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: regex
Dummy1912
can you make it work like my own example #XTechVB
because its all in 1 sub :)
so i don't need to use if s.contains("call") then

if you get me :)
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: regex
Dummy1912
ok but still

i need to use
Code: Select all
s = ss.Replace(s, "<a href=""${call}"" title=""Call me"" "">Call ${call}'here only the name without call:</a>")
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
XTechVB
VIP - Site Partner
VIP - Site Partner
Posts: 727
Joined: Thu May 20, 2010 10:32 am

Re: regex
XTechVB
Well this example works fine
Code: Select all
        Dim Rgx As Regex = New Regex("call:?\W\S*")
        For Each RgMatch As Match In Rgx.Matches(TextBox1.Text)
            Dim FoundCall As String = RgMatch.Value.Substring(5, RgMatch.Value.Length - 5)
            TextBox1.Text = TextBox1.Text.Replace(RgMatch.Value, "<a href=" + """" + FoundCall + """" + " title=""Call me"" "">Call " + FoundCall + "</a>")
        Next
You can find me on Facebook or on Skype mihai_92b
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: regex
Dummy1912
#XTechVB

its not working :(
You do not have the required permissions to view the files attached to this post.
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
XTechVB
VIP - Site Partner
VIP - Site Partner
Posts: 727
Joined: Thu May 20, 2010 10:32 am

Re: regex
XTechVB
Dummy1912 wrote:
#XTechVB

its not working :(
I don't know what to tell you for me it works fine.
I'll send you the application.
You can find me on Facebook or on Skype mihai_92b
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: regex
Dummy1912
thanks for the demo works fine at some minus parts :)
if you can do what i PMed you
then ill try to see where my problem stuck :)
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
11 posts Page 1 of 2
Return to “Coding Help & Support”