all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Angus Comber <anguscomber@gmail.com>
To: Thorsten Jolitz <tjolitz@gmail.com>
Cc: Emacs Help <help-gnu-emacs@gnu.org>
Subject: Re: How to highlight-regexp across multiple lines
Date: Fri, 4 Apr 2014 10:58:41 +0100	[thread overview]
Message-ID: <CAAtGUhUCPXpzBSUoAh6HWUgMiVEEKyYKmVc8hNdd11pjQf-E9Q@mail.gmail.com> (raw)
In-Reply-To: <87eh1ei5ib.fsf@gmail.com>

Strangely, this works better:

aPDU[^W]+[}]$


[^W] is definitely mystifying.  Others eg [^some other letter] can work -
but only if your target block doesn't contain that letter.  And some of
them don't work at all - puzzling.

Even then, its mysterious because in a fairly large log file I have ALL
aPDU's were highlighted correctly except this text where the selected text
was from the start of the first to the end of the second one.

aPDU-rose : invoke : {
  invokeID 11,
  operationValue local : 21,
  argument {
    crossRefIdentifier '40 2f'H,
    eventSpecificInfo callEvent : connectionClearedEvent : {
      droppedConnection {
        call '02 01 19 0f'H,
        device staticID : dialingNumber : "403"
      },
      releasingDevice deviceIdentifier : deviceIdentifier : dialingNumber :
"403",
      localConnectionInfo connect,
      cause normalClearing
    }
  }
}
   -- monitor: 402
   -- CSTA Fwk : set control party
   -- setting cntrlDN=403 (for 1 parties)
   -- event ignored
  +++ Calls dump +++
    1 connids, 1 threads, 1 calls
    1:876002435e991001@2d8f990 2d8fc98:1[d403.2d90a08:1/EA-O
d402.2d91e28:2/EA-D]
  --- Calls dump ---
18:36:28.116 --- Input ---
18:36:28.125 +++ Input +++
18:36:28.125 DataFromSwitch 14 bytes
0000-000d 00 0c a2 0a 02 01 1e 30 05 02 01 05 05 00       |.......0......  |
  Decoded:
aPDU-rose : retResult : {
  invokeID 30,
  operValue {
    operationValue local : 5,
    result noData : NULL
  }
}



On 3 April 2014 20:21, Thorsten Jolitz <tjolitz@gmail.com> wrote:

> Angus Comber <anguscomber@gmail.com> writes:
>
> > It seems that it matches the aPDU messages provided there is no 0 in the
> > text.  I am puzzled by the [^\\000] - where can I find documentation on
> it?
>
> Thats stolen from the Org-mode sources, and I asked the same question
> before ;)
>
> Here is Carsten Dominik's answer:
>
>
> ,----------------------------------------------------------------------------
> | > PS
> | > Can anybody explain this marvelous construct in the regexp:
> | >
> | > ,---------
> | > | [^\\000]
> | > `---------
> |
> | This is just a cheep way to match any character at all, because \000
> should
> | not be part of any string (in C it indicates the end of a string).
> | In principle you could put any character you are sure will not turn up,
> | but \000 seems to be the safest choice.  It is
> | faster (I think) than "\\(.\\|\n\\)*" because the first will
> | just run fast and streight with a table lookup while the
> | latter need to always alternate between two alternatives.
> | I have not timed it, though.
>
> `----------------------------------------------------------------------------
>
> > Is it not null or something like that?  But then why does it not capture
> > string "0"?
>
> This happened to me to, although I think it shouldn't.
>
> But when I used it with M-x regexp-builder it worked. With M-x reb-copy
> (and then paste), the [^\\000] is transformed to a different
> representation - maybe you could try reb-copy & paste it into your
> function and see if it works then?
>
> > On 3 April 2014 16:08, Thorsten Jolitz <tjolitz@gmail.com> wrote:
> >
> >> Angus Comber <anguscomber@gmail.com> writes:
> >>
> >> > I was looking at this question on stackoverflow and it seems regex can
> >> > select across multiple lines generally but how would I do so for
> >> > highlight-regexp in emacs?
> >> >
> >> >
> >>
> http://stackoverflow.com/questions/159118/how-do-i-match-any-character-across-multiple-lines-in-a-regular-expression
> >> >
> >> >
> >> > Eg I want to highlight ALL text from aPDU... to the final closing
> brace:
> >> >
> >> > aPDU-rose : retResult : {
> >> >   invokeID 2,
> >> >   operValue {
> >> >     operationValue local : 71,
> >> >     result {
> >> >       crossRefIdentifier '40 3f'H
> >> >     }
> >> >   }
> >> > }
> >> >
> >> >
> >> > How would I do that using highlight-regexp?
> >> >
> >> > highlight-regexp aPDU-rose.* hi-yellow  would get me the first line -
> but
> >> > how to get everything including last } character?
> >>
> >> This regexp did match the aPDU in the gnus *Article* buffer:
> >>
> >> ,--------------------
> >> | "^aPDU[^\\000]+[}]+?$"
> >> `--------------------
> >>
> >> --
> >> cheers,
> >> Thorsten
> >>
> >>
> >>
> >
>
> --
> cheers,
> Thorsten
>
>
>


  reply	other threads:[~2014-04-04  9:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-03 14:43 How to highlight-regexp across multiple lines Angus Comber
2014-04-03 15:08 ` Thorsten Jolitz
2014-04-03 15:22   ` Angus Comber
2014-04-03 17:24   ` Angus Comber
2014-04-03 19:21     ` Thorsten Jolitz
2014-04-04  9:58       ` Angus Comber [this message]
2014-04-04 10:35         ` Thorsten Jolitz
2014-04-04 10:49 ` Nicolas Richard
2014-04-04 10:50   ` Nicolas Richard
2014-04-04 12:50   ` Angus Comber
2014-04-04 13:26     ` Thorsten Jolitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAtGUhUCPXpzBSUoAh6HWUgMiVEEKyYKmVc8hNdd11pjQf-E9Q@mail.gmail.com \
    --to=anguscomber@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=tjolitz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.