Permalink
Browse files

Add more characters in URL regexp

  • Loading branch information...
1 parent f613c53 commit e9a19cec3d44a5ecc0b0f643b8e6ddaccce152ac @VictorNicollet committed Oct 17, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 ohmText/ohmText_format.mll
@@ -9,6 +9,8 @@
}
+let urlchar = ['A'-'Z' '0'-'9' 'a'-'z' '.' '-' '_' '/' '?' '&' '=' '#' ':' '%' '+' ]
+
rule format acc state = parse
| [ '\t' ' ' '\r' ]
@@ -39,9 +41,9 @@ rule format acc state = parse
) ;
format acc state lexbuf }
- | ( "http://" ['A'-'Z' '0'-'9' 'a'-'z' '.' '-' '_' '/'] +
- | "https://" ['A'-'Z' '0'-'9' 'a'-'z' '.' '-' '_' '/'] +
- | "www." ['A'-'Z' '0'-'9' 'a'-'z' '.' '-' '_' '/'] +) as url
+ | ( "http://" urlchar +
+ | "https://" urlchar +
+ | "www." urlchar +) as url
{ if state.url then (
Ohm.Html.str "<a href=\"" acc ;
Ohm.Html.str (if BatString.starts_with url "www" then "http://" else "") acc ;

0 comments on commit e9a19ce

Please sign in to comment.