From owner-freebsd-questions@FreeBSD.ORG Wed Sep 9 16:15:35 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C68C01065676 for ; Wed, 9 Sep 2009 16:15:35 +0000 (UTC) (envelope-from drew@mykitchentable.net) Received: from smtp2.mc.surewest.net (qsmtp.mc.surewest.net [66.60.130.145]) by mx1.freebsd.org (Postfix) with SMTP id A03458FC2E for ; Wed, 9 Sep 2009 16:15:35 +0000 (UTC) Received: (qmail 31217 invoked from network); 9 Sep 2009 09:00:04 -0700 Received: by simscan 1.1.0 ppid: 31196, pid: 31197, t: 2.2815s scanners: regex: 1.1.0 attach: 1.1.0 spam: 3.1.7-deb X-Spam-Checker-Version: SpamAssassin 3.1.7-deb (2006-10-05) on smtp2.surewest.net. X-Spam-Level: X-Spam-Status: No, score=0.0 required=13.5 tests=none autolearn=disabled version=3.1.7-deb X-Spam-CMAE-Analysis: v=1.0 c=1 a=jDt-9pEAAAAA:8 a=Cj_EnRuX-TQiqHYdMyQA:9 a=ozIUDivR9eQzO1JPR3gA:7 a=OPDA1eu7zrg-eO-4uCAUUthL2JMA:4 Received: from unknown (HELO blacklamb.mykitchentable.net) (69.62.230.77) by smtp2 with SMTP; 9 Sep 2009 09:00:02 -0700 Received: from [127.0.0.1] (bigdaddy.mykitchentable.net [192.168.1.3]) by blacklamb.mykitchentable.net (Postfix) with ESMTPA id 98EAA165575 for ; Wed, 9 Sep 2009 09:15:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mykitchentable.net; s=default; t=1252512930; bh=2RCt11JEF8IOAM7pJf5Dy5I8dS/6Wg9n1CLCGz4Arbo=; h=Message-ID:Date:From:MIME-Version:To:Subject:Content-Type: Content-Transfer-Encoding; b=XgCH1md9K89iZl/nYfYCSNh0dbh2ESDB9E0tDvzx8b0IZlYDMslxSmI5EslNAL66T 0sY/nZHZoj+w7ep0Wcr3/lA0Hr2Be8NXtDQuh7wc63unBThl03UKNG/FVpZEUT+fig JukEJ6Uo1WGYBp8k52kRS+VVHpBtBdCCOLf2v3xU= Message-ID: <4AA7D49D.8090002@mykitchentable.net> Date: Wed, 09 Sep 2009 09:15:25 -0700 From: Drew Tomlinson User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 090908-0, 09/08/2009), Outbound message X-Antivirus-Status: Clean Subject: Regex Help - Greedy vs. Non-Greedy X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2009 16:15:35 -0000 I'm trying to do a search and replace in vim. I have lines like this: http://site1/dir/; http://site2/dir/;LastName, FirstName;Phone; http://site3/dir/;LastName, FirstName; http://site4/dir/; I'm want to match "http:*" and stop matching at the first ";". My basic regex is: /http:.\+;/ But it's matching *all* the semi-colons. Thus I've Googled and tried various incatations to try and make my regex "non-greedy" but I can't seem to come up with the correct combination. How can I write a regex that stops matching at the first semi-colon? Thanks, Drew -- Be a Great Magician! Visit The Alchemist's Warehouse http://www.alchemistswarehouse.com