Are you looking for this?
(replace-regexp-in-string "\\<\\(some\\)." "" "something" nil nil 1) ; => "thing"
Some unsolicited advice:
You really should try harder to make your questions clearer. For example, your question (apparently) has nothing to do with inserting or
insert. You should remove that part from the question, as it's only noise. Take that out of the equation.
Learn to read the error message and backtrace clearly. It says that the error occurred when
string-match was called by
Read the doc for
replace-regexp-in-string and the Elisp manual about regexps. You must have read the manual a bit, or learned elsewhere (1) that
\< matches the start of a word and (2) you need to double a backslash in a Lisp string.
But you haven't learned about matching a subexpression (a regexp group). Read the doc string of
replace-regexp-in-string and study the expression in this answer - see why I created a group and referenced it with argument
1 in the
It's clear that you're trying, and learning. But you have trouble expressing your questions clearly. Trying to do that better will, in itself, help you learn. And it will get you more help from others. No one wants to guess what you're really asking or play a 20-questions game to find out. It's up to you to express yourself clearly.