Letractively / dotnetkicks

Automatically exported from code.google.com/p/dotnetkicks
1 stars 0 forks source link

TextHelper.Urlify bug #99

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The TextHelper.Urlify method does not match urls which contain a '?'. There
is a failing unit test in TextHelperTests.

The current RegEx is:

((ht|f)tp(s?))\://([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,6}(\:[0-9]+)?(/\S*)?

Anyone good at Regular Expressions?

Original issue reported on code.google.com by gavinjo...@gmail.com on 16 Sep 2007 at 6:32

GoogleCodeExporter commented 9 years ago
you mean when a url has a ? as part of the query string?

That seems to work when I test it:

Pattern: ((ht|f)tp(s?))\://([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,6}(\:[0-9]+)?(/\S*)?
Test: http://www.whatever.com/page.aspx?id=7
1 match found

I use http://regexlib.com/RETester.aspx to test the pattern.

Original comment by james.e....@gmail.com on 16 Sep 2007 at 6:49

GoogleCodeExporter commented 9 years ago
So it does, thanks.

The bug was in the Regex.Replace() call. I've replaced it with String.Replace 
and all
is good.

Fixed for SVN revision 344.

Original comment by gavinjo...@gmail.com on 16 Sep 2007 at 7:01