| Author |
Help with Regex
|
Jordan Smith
Ranch Hand
Joined: Apr 06, 2008
Posts: 89
|
|
Hi
I would my regular expression to convert URL to click here + a href.
I have the following regular expression:
But in case that the user enters a URL with comma or period in the end, it converts it with the comma.
for example:
"go to http://jpost.com, and have fun"
will be go to click here
but the comma shouldn't be included in the href!
how can i write the regular expression so if there is comma/period + space, it would ignore it?
Thanks!
|
 |
Piet Verdriet
Ranch Hand
Joined: Feb 25, 2006
Posts: 266
|
|
(The forum software "eats" the anchor tags, so add "href=" in front of "\"$0\"")
Note that the solution above will only accept urls that end with a letter. Expand it as you see fit.
|
 |
Jordan Smith
Ranch Hand
Joined: Apr 06, 2008
Posts: 89
|
|
Hi!
it's not working with URL that have , in them.
like:
http://www.ynetnews.com/articles/0,7340,L-3670012,00.html
how can i enable in the regex comma or minus only if it comes with out space after the charachter?
Thanks!
|
 |
Piet Verdriet
Ranch Hand
Joined: Feb 25, 2006
Posts: 266
|
|
It works fine with me.
|
 |
Jordan Smith
Ranch Hand
Joined: Apr 06, 2008
Posts: 89
|
|
you are right.
it works perfect - i didn't clear the cache.
Thanks alot!!
|
 |
Piet Verdriet
Ranch Hand
Joined: Feb 25, 2006
Posts: 266
|
|
odelya yomtov-glick wrote:you are right.
it works perfect - i didn't clear the cache.
Thanks alot!! 
No problem.
|
 |
 |
|
|
subject: Help with Regex
|
|
|