views:

69

answers:

1

based on this post link text

i came up with a regex for javascript

\b(([\w-]+:\/\/?|[\w\d]+[.])?[^\s()<>]+[.](?:\([\w\d]+\)|([^`!()\[\]{};:'".,<>?«»“”‘’\s]|\/)))

this one matches urls like

http://google.com

http://www.google.com

google.com

and fail for

google

but when i used japanese characters like

功功.jp

it fails.

only

www.功功.jp

http://www.功功.jp

http://功功.jp

matches.

wat should i change so that 功功.jp also matches.

+1  A: 

Very slight modification made here has it working for me:

/(([\w-]+:\/\/?|[\w\d]+[.])?[^\s()<>]+[.](?:\([\w\d]+\)|([^`!()\[\]{};:'\".,<>?«»“”‘’\s]|\/)+))/
JGB146
thanks a lot. that worked perfectly.
railscoder