From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rivka Miller Newsgroups: gmane.emacs.help Subject: Re: Quickie - Regexp for a string not at the beginning of the line Date: Thu, 25 Oct 2012 18:08:53 -0700 (PDT) Message-ID: <73f60cf3-d932-4366-a405-6767488560c6@q16g2000yqc.googlegroups.com> References: <9eba5652-f814-41fa-83e4-460bca2be264@n16g2000yqi.googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1351213815 15942 80.91.229.3 (26 Oct 2012 01:10:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 26 Oct 2012 01:10:15 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 26 03:10:24 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TRYRI-0000W7-8j for geh-help-gnu-emacs@m.gmane.org; Fri, 26 Oct 2012 03:10:20 +0200 Original-Received: from localhost ([::1]:58508 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRYRA-0003wh-C7 for geh-help-gnu-emacs@m.gmane.org; Thu, 25 Oct 2012 21:10:12 -0400 Original-Received: by 10.224.180.141 with SMTP id bu13mr6950907qab.2.1351213733271; Thu, 25 Oct 2012 18:08:53 -0700 (PDT) Original-Received: by 10.236.192.164 with SMTP id i24mr2198167yhn.14.1351213733239; Thu, 25 Oct 2012 18:08:53 -0700 (PDT) Original-Path: usenet.stanford.edu!x14no8156904qar.0!news-out.google.com!r17ni57592152qap.0!nntp.google.com!x14no8496821qar.0!postnews.google.com!q16g2000yqc.googlegroups.com!not-for-mail Original-Newsgroups: comp.unix.shell, comp.lang.javascript, comp.lang.python, gnu.emacs.help, comp.emacs Complaints-To: groups-abuse@google.com Injection-Info: q16g2000yqc.googlegroups.com; posting-host=99.103.152.167; posting-account=V5Tx-QoAAACNTDxOswIwdOklJAUE-vym Original-NNTP-Posting-Host: 99.103.152.167 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0,gzip(gfe) Injection-Date: Fri, 26 Oct 2012 01:08:53 +0000 Original-Xref: usenet.stanford.edu comp.unix.shell:256064 comp.lang.javascript:631037 comp.lang.python:686465 gnu.emacs.help:195098 comp.emacs:102657 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:87427 Archived-At: On Oct 25, 2:27=A0pm, Danny wrote: > Why you just don't give us the string/input, say a line or two, and what = you want off of it, so we can tell better what to suggest no one has really helped yet. I want to search and modify. I dont wanna be tied to a specific language etc so I just want a regexp and as many versions as possible. Maybe I should try in emacs and so I am now posting to emacs groups also, although javascript has rich set of regexp facilities. examples $hello$ should not be selected but not hello but all of the $hello$ and $hello$ ... $hello$ each one selected =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D original post =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Hello Programmers, I am looking for a regexp for a string not at the beginning of the line. For example, I want to find $hello$ that does not occur at the beginning of the string, ie all $hello$ that exclude ^$hello$. In addition, if you have a more difficult problem along the same lines, I would appreciate it. For a single character, eg < not at the beginning of the line, it is easier, ie ^[^<]+< but I cant use the same method for more than one character string as permutation is present and probably for more than one occurrence, greedy or non-greedy version of [^<]+ would pick first or last but not the middle ones, unless I break the line as I go and use the non- greedy version of +. I do have the non-greedy version available, but what if I didnt? If you cannot solve the problem completely, just give me a quick solution with the first non beginning of the line and I will go from there as I need it in a hurry. Thanks