all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* category codes and regexps
@ 2004-07-25 20:59 Werner LEMBERG
  2004-07-25 23:59 ` Kenichi Handa
  2004-07-26 19:26 ` Stefan Monnier
  0 siblings, 2 replies; 6+ messages in thread
From: Werner LEMBERG @ 2004-07-25 20:59 UTC (permalink / raw)



Assume that I want to check a buffer for characters which aren't Thai,
and which aren't in the range a-z.  My first idea was this:

  [^\cta-z]

This fails because `\' isn't special within [...].  What's the correct
(interactive) way to do that?  I tried hard without finding a regexp
which can handle this.


    Werner

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: category codes and regexps
  2004-07-25 20:59 category codes and regexps Werner LEMBERG
@ 2004-07-25 23:59 ` Kenichi Handa
  2004-07-26  2:05   ` Werner LEMBERG
  2004-07-26 19:26 ` Stefan Monnier
  1 sibling, 1 reply; 6+ messages in thread
From: Kenichi Handa @ 2004-07-25 23:59 UTC (permalink / raw)
  Cc: emacs-devel

In article <20040725.225927.239650643.wl@gnu.org>, Werner LEMBERG <wl@gnu.org> writes:

> Assume that I want to check a buffer for characters which aren't Thai,
> and which aren't in the range a-z.  My first idea was this:

>   [^\cta-z]

> This fails because `\' isn't special within [...].  What's the correct
> (interactive) way to do that?  I tried hard without finding a regexp
> which can handle this.

Unfortunately [...] can't be used with category nor syntax.

[ ^ a - z ESC : (insert (make-char 'thai-tis620 #x20)) RET
  - ESC : (insert (make-char 'thai-tis620 #x7f)) RET
]

will produce a regex that you want.

Another way is to make a new category (say, menumonic `T')
that contains a-z and Thai.  Then you can specify:
    \CT

---
Ken'ichi HANDA
handa@m17n.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: category codes and regexps
  2004-07-25 23:59 ` Kenichi Handa
@ 2004-07-26  2:05   ` Werner LEMBERG
  0 siblings, 0 replies; 6+ messages in thread
From: Werner LEMBERG @ 2004-07-26  2:05 UTC (permalink / raw)
  Cc: emacs-devel

> > Assume that I want to check a buffer for characters which aren't Thai,
> > and which aren't in the range a-z.  [...]

> Unfortunately [...] can't be used with category nor syntax.
> 
> [ ^ a - z ESC : (insert (make-char 'thai-tis620 #x20)) RET
>   - ESC : (insert (make-char 'thai-tis620 #x7f)) RET
> ]
> 
> will produce a regex that you want.
> 
> Another way is to make a new category (say, menumonic `T')
> that contains a-z and Thai.  Then you can specify:
>     \CT

Thanks for the quick reply.  Both solutions are much uglier than
expected :-(

Wouldn't it be possible to extend the [...] syntax, say, to use the
already existing [:...:] character classes construct:

  [^a-z[:\ct:]]

At first sight, I can't see a conflict.


    Werner


PS: In elisp.info, the sentence

      For the description of the known categories, type `M-x
      describe-categories <RET>'.

    is missing at the end of the description of `\cC' (in node `Regexp
    Backslash').  In general, it would be useful to unify the regexp
    descriptions of emacs.info and elisp.info.

    Finally, the output of `describe-categories' is very crude and
    probably causes some worries for the beginner.  Maybe this can be
    beautified, with some explanations at the beginning.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: category codes and regexps
  2004-07-25 20:59 category codes and regexps Werner LEMBERG
  2004-07-25 23:59 ` Kenichi Handa
@ 2004-07-26 19:26 ` Stefan Monnier
  2004-07-26 19:48   ` David Kastrup
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2004-07-26 19:26 UTC (permalink / raw)
  Cc: emacs-devel

> Assume that I want to check a buffer for characters which aren't Thai,
> and which aren't in the range a-z.  My first idea was this:

>   [^\cta-z]

 \(?:[a-z]\|\ct\)


        Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: category codes and regexps
  2004-07-26 19:26 ` Stefan Monnier
@ 2004-07-26 19:48   ` David Kastrup
  2004-07-26 21:14     ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: David Kastrup @ 2004-07-26 19:48 UTC (permalink / raw)
  Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> > Assume that I want to check a buffer for characters which aren't Thai,
> > and which aren't in the range a-z.  My first idea was this:
> 
> >   [^\cta-z]
> 
>  \(?:[a-z]\|\ct\)

What part about "which aren't" did you not understand?

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: category codes and regexps
  2004-07-26 19:48   ` David Kastrup
@ 2004-07-26 21:14     ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2004-07-26 21:14 UTC (permalink / raw)
  Cc: emacs-devel

>> > Assume that I want to check a buffer for characters which aren't Thai,
>> > and which aren't in the range a-z.  My first idea was this:
>> 
>> >   [^\cta-z]
>> 
>> \(?:[a-z]\|\ct\)

> What part about "which aren't" did you not understand?

Damn!


        Stefan "Oops"

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-07-26 21:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-25 20:59 category codes and regexps Werner LEMBERG
2004-07-25 23:59 ` Kenichi Handa
2004-07-26  2:05   ` Werner LEMBERG
2004-07-26 19:26 ` Stefan Monnier
2004-07-26 19:48   ` David Kastrup
2004-07-26 21:14     ` Stefan Monnier

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.