I am doing (bounds-of-thing-at-point 'word)
to capture words in a buffer.
(let* ( (bounds (bounds-of-thing-at-point 'word))
(word (buffer-substring (car bounds) (cdr bounds)))
I then match the word with a regexp, either frontally, medially, or posteriorly.
"\\<\\([Ee]xt[ei]r\\|[Ee]ntr[aeiu]\\)"
"\\([[:alpha:]]+\\)\\(p[ai]ra\\|peri\\)\\([[:alpha:]]+\\)"
"\\([eu]ckle\\|[ai]cle\\|ical\\)\\>"
I want to allow the possibility for words to include hyphens (-
) and punctuation.
As examples, the following are mentioned: (real-
, short-time-Fourier-transformation
, "wavelet footprints"
.
From some tests I have done, it seems that the captured words using bounds-of-thing-at-point
disregards hyphens (-
) and punctuation.
I am concluding that I do not have to include any punctuation in my string regexp, and can safely neglect [[:punct:]]?
in the following regexp.
"\\([[:alpha:]]+[-]?\\)ple\\([[:alpha:]]+[[:punct:]]?\\)"
Is my general assessment of not requiring the use of [[:punct:]]?
in my regexp correct?