- Subject: Re: [jed-users] word chars
- From: jed@xxxxxxxxxxx (John E. Davis)
- Date: Mon, 30 Apr 2018 12:27:44 -0400
Hi Peter,
Peter D. Gray <pdg@xxxxxxxxxx> wrote:
> I have tried a simple word_chars = 'char list'
As others have stated, you need to use the define_word function. It
takes a single string expression that defines the characters that
should be treated as a word by the delete_word, upcase_word,
skip_word, etc functions.
You most likely saw a syntax error because slang strings require
double quotes, e.g., "char list" and not 'char list'.
The string that the define_word function takes may consist of a
combination of character ranges such as `A-Z' and character classes:
\w matches a unicode "word" character, taken to be alphanumeric.
\a alphabetic character, excluding digits
\s matches whitespace
\l matches lowercase
\u matches uppercase
\d matches a digit
\, matches punctuation
\\ matches a backslash
\^ matches a ^ character
If the first character of a set is `^' then the set is taken to
be the complement set.
The default setting for word characters is \w. Note that when used in
slang code, the backslash character must be escaped:
define_word ("\\w");
Alternatively, you can use one of these forms:
define_word ("\w"R); % a "raw" string
define_word (`\w`); % Another form
Finally, note that the word specifier may take a combination such as
define_word (`-A\a\d_`); % hyphen + alphabetic + digits + underschore
define_word (`^\s`); % Anything but whitespace
Note the placement of the hyphen character in the first example. If
you want to include a hyphen, make it the first character in the
string to avoid it be interpreted as a range.
I hope this helps.
--John
_______________________________________________
For list information, visit <http://jedsoft.org/jed/mailinglists.html>.
[2018 date index]
[2018 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]