My goal is to write a quick function that will return me a name
without some selected parts, either by searching for strings or regular
expressions in the source string. The second step would be to remove
the string I found. Maybe with replace-match?
Example:
myfile.gz would be myfile
If I always knew that the .gz would be on the end I think I could
somehow use substring to strip off the .gz part by stripping off the
last three characters.
What do you think?
--
MM
Using string-match and replace-match is the usual paradigm.
Another possibility is to use parenthesized subexpressions in the regexp
you pass to string-match, and then use substring with values returned by
match-beginning and match-end.
BTW, where did you find this in the documentation. Now that I know
what it is called I can do a C-h f, but how did you find this prior to
knowing what it is?
M-x apropos lets you search for things with regular expressions. This should
not be confused with `apropos-command' (Bound to C-h a) which only shows
interactive commands.
If you don't have it already you should also get the Emacs-Lisp manual from
your closest GNU mirror.
Henrik
--
Soylent Green is People!
> M-x apropos lets you search for things with regular expressions. This should
> not be confused with `apropos-command' (Bound to C-h a) which only shows
> interactive commands.
Cool! Thank you.
>
> If you don't have it already you should also get the Emacs-Lisp manual from
> your closest GNU mirror.
I have it and could not find the function I needed in the manual, that
is why I asked.
> Soylent Green is People!
Cool tag line. I have not heard a reference to Soylent Green in a
long time. :-)
Thanks again.
--
MM
>BTW, where did you find this in the documentation. Now that I know
>what it is called I can do a C-h f, but how did you find this prior to
>knowing what it is?
you wanted to know something about searching, so bring up the manual and
use the `m' and `i' commands using that word or it's stem, e.g., ``\c-h i m
emacs <ret> m search <ret>''.
--
okay, have a sig then