lib/wparser/inline/http.rb in wparser-0.1.2 vs lib/wparser/inline/http.rb in wparser-0.1.3
- old
+ new
@@ -5,13 +5,25 @@
# (?<![.,?\!]) 1.8.7では後読みが出来ない、どーするか。
def self.parse text
url_rex = %r!
\b
(
- http:// [-a-z0-9]+(\.[-a-z0-9]+)*\.(com|edu|info|net) \b
- (
+ https?:// [-a-z0-9]+(\.[-a-z0-9]+)*\.(?:com
+ |edu
+ |biz
+ |org
+ |gov
+ |in(?:t|fo)
+ |mil
+ |net
+ |name
+ |museum
+ |coop
+ |aero
+ |[a-z][a-z]) \b
+ (?:
/ [-a-z0-9_:\@&?=+,.\!/~*'%\$]*[^.,?\!]
- )?
+ )? \b
)
!x
@result = text.gsub(url_rex){|s| "<a href=\"#$1\">#$1</a>"}
super