Re: regex, negations, grep, find and replace (a few questions)



Moe Trin wrote:

On Sun, 25 Nov 2007, in the Usenet newsgroup alt.os.linux, in article
<bd3885ea-1f0f-4437-88bb-70962513b3de@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
jameshanley39@xxxxxxxxxxx wrote:


NOTE: Posting from groups.google.com (or some web-forums) dramatically
reduces the chance of your post being seen. Find a real news server.


hmm, that points out an interesting reason to use a news reader-
filters for removing spam.

ok, I just switched to my news reader. Though a reason I was on google
was since I am posting from a new [windows] user account. The news
reader has all its settings fresh. So for every newsgroup I post to, I
have to add the newsgroup [again]. No big deal, but a bit boring in a
GUI.

Is there anything like grep that does not have this problem/feature
? or where that problem/feature can be turned off?

Problem is the multi-line thing. Generally, I'll convert things to a
large single line - how depends STRONGLY on the format of the file I'm
searching through. But look at 'awk' and 'sed' and the fact that
you can use addressing. Another technique for multi-line searches
would be to use grep to find (example) the 'http' key, and use the
'-A 1' option to grab this AND the following line - then slip the
result through 'tr' to delete the embedded newline, then sed, or cut
to strip out the desired pattern.

I heard that it is hard to negate a regex.

No where near enough information.


well, if one/I/"you" wanted to match NOT "hello world" , using a regex.

I do not know much regex. But it seems as if you define each character
individually. Except with * which defines many, and since . means any,
so .* defines a string of any.

it seems like you can only negate characters. or many of certain
characters.

If you are saying NOT hello. you really want to say NOT (h followed by
e, followed by l.......)

Then neither of these will do it
[^hello] (no order is specified there, it is an OR. on one character
it is just a NOT(A OR B OR C)

And tihs will not do it either
[^h][^e][^l][^l][^o]...
it defines an order but is some very strict thing which will come out
FALSE.

Apparently it is hard, and ugly too, moreso for a long string, to say
NOT (h followed by e, .....)

note- i have a program called regex coach in windows. If you heard of
it, do you know of a linux equivalent, or more appropriate linux
program? It shows you if a regex pattern matches some target string,
and updates itself each time you enter a new character into the regex
pattern or target string. It highlights the match(es).


<snip other useful things>



--

.



Relevant Pages

  • Re: Character information from Jo
    ... Kenny wrote: ... the history of a character in a sensational way to get attention (when ... It does seem that she is saying stuff like this for both shock effect and to keep her name in the news -- perhaps because it's a backhanded way of promoting her upcoming mystery book -- or whatever it is. ... Also think about Diggory in the GOF movie. ...
    (alt.fan.harry-potter)
  • Re: Men are too frightened to give women the compliments they need
    ... But feminism leaves out the part where women are suppose to be under ... the good news of the risen Christ. ... life must be. ... the worse light, the title character Raymond or his wife Debra, ...
    (soc.men)
  • Re: Stuff I have learned this week from the P-Dub
    ... People can't seem to let go that the WWE forced him ... He should get the title shot, but if the news is true... ... about being too soon and not giving enough time to develop the character. ... the Vince Harassment story. ...
    (rec.sport.pro-wrestling)
  • Re: Panic Chrontic Camera
    ... touch Panasonic kit again. ... As JF pointed out - news>transport is not guaranteed to be 8-bit clean. ... >same assumptions as the original poster's, they may appear>differently (with the recipient having chosen a different>character set or regional assumptions). ... >journey to the reader's news server through a server which>does not honour the eighth bit. ...
    (uk.people.silversurfers)
  • Re: Livening up a Scene
    ... >> battle scene, you'll do something else, and if the herois walking ... Tension comes from the reader *expecting* something, ... walking into a room; there's a letter, bet it's bad news; he reads it; yup, ... letter, not an exploding one, or if reader and character are expecting good ...
    (rec.arts.sf.composition)