Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Regexp
- Date: Wed, 05 May 2004 17:41:43 +0900
- From: "Stephen J. Turnbull" <stephen@example.com>
- Subject: Re: [tlug] Regexp
- References: <opr7ijemu64iw62b@example.com>
- Organization: The XEmacs Project
- User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Portable Code, linux)
>>>>> "Daniel" == Daniel Quimper <dq@example.com> writes: Daniel> I looking for a regular expression that would match Daniel> everything except a particuliar string. Taking your egrep example seriously (ie, line-oriented behavior) ^[^a]*(a+([^ab][^a]*|b[^ac][^a]*)?)*$ should work. Note that this only works because the first character is different from both the second and the third, things are more complicated if you have to worry about possibly matching the string partially internally to itself. The two-character negated classs [^ab] and [^ac] do need to include 'a' so that the a+ eats all the 'a's in a row: a+[^b][^a]* does match "aabc": the first 'a' matches a+, the second 'a' matches [^b], and 'bc' matchs [^a]*. Similarly a+b[^c][^a]* matches "ababc". (That should give the flavor of what is meant by "possible partial internal match".) Daniel> Changing the software is not an option. Maybe changing jobs is? Life is too short to try to do this kind of task with regexps. The "abc" example is _easy_. -- Institute of Policy and Planning Sciences http://turnbull.sk.tsukuba.ac.jp University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN Ask not how you can "do" free software business; ask what your business can "do for" free software.
- Follow-Ups:
- Re: [tlug] Regexp
- From: Daniel Quimper
- References:
- [tlug] Regexp
- From: Daniel Quimper
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] NEC Aterm DR302 and SSH timeouts
- Next by Date: Re: [tlug] Regexp
- Previous by thread: [tlug] Regexp
- Next by thread: Re: [tlug] Regexp
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links