On Jun 15, 2005, at 2:52 PM, Chris Eidhof wrote: > On Thu, Jun 16, 2005 at 06:44:50AM +0900, Ezra Zygmuntowicz wrote: > >> Hello list! >> Could someone help me do a little regex conversion? I've got a >> few perl compatible regexes from a php script I am trying to port to >> ruby but I need a little help. Here are the php functions: >> > > >> $buffer = preg_replace("#(?<!\"|http:\/\/)www\.(?:[a-zA-Z0-9\-]+\.)* >> [a-zA-Z]{2,4}(?:/[^ \n\r\"\'<]+)?#", "http://$0", $buffer); >> $buffer = preg_replace("#(?<!\"|href=|href\s=\s|href=\s|href\s=) >> (?:http:\/\/|https:\/\/|ftp:\/\/)(?:[a-zA-Z0-9\-]+\.)+[a-zA-Z]{2,4} >> (?::[0-9]+)?(?:/[^ \n\r\"\'<]+)?#", "<a href=\"$0\" target=\"_blank >> \"> >> $0</a>", $buffer); >> $buffer = preg_replace("#(?<=[\n ])([a-z0-9\-_.]+?)@([^,< \n\r]+)#i", >> "<a href=\"mailto:$0\">$0</a>", $buffer); >> > I'm willing to help, but could you give a little more detail on what > the regexen should do? > -- > Best regards, > Chris Eidhof > Thanks Chris- I was able to hack these out and get them to work in ruby. They just do some formatting and conversion of some hyperlinks and ftp links. It was the (?....) grouping that was messing things up a bit. Thanks all the same though! -Ezra Zygmuntowicz Yakima Herald-Republic WebMaster 509-577-7732 ezra / yakima-herald.com