This is something I suppose could work for you:
\documentclass{article}
\usepackage{caption}
\usepackage{hyperref}
\def\myEmptyLabel#1{}
\newcommand{\removelabel}[1]{\let\oldlabel\label\let\label\myEmptyLabel#1\let\label\oldlabel} % some code
\begin{document}
\begin{minipage}{\textwidth}
\removelabel{\captionof{figure}{\label{some_label} This label should be removed}} % output: 'This label should be removed'
\end{minipage}
\removelabel{This string is already label-less} % output: 'This string is already label-less
Figure~\ref{some_label}
\end{document}
In the output the label is not defined and returns questionmarks
Edit:
\documentclass{article}
\usepackage{caption}
\usepackage{hyperref}
\def\myEmptyLabel#1{}
\newcommand{\removelabel}[1]{\let\oldlabel\label\let\label\myEmptyLabel\xdef\removedlabel{#1}\let\label\oldlabel} % some code
\begin{document}
\removelabel{\label{some_label} This label should be removed}
\removedlabel
\removelabel{This string is already label-less} % output: 'This string is already label-less
\removedlabel
%Figure~\ref{some_label}
\end{document}
Now \removedlabel gives the string without the label... But I am not sure what you want to do... May be you should be more clear on what you expect from the command.
\BODYas its argument. – noibe Feb 17 '19 at 02:45\labelplus the following undelimited argument be removed from the "string" or shall only the very first instance thereof be removed? What about instances thereof that within the "string" in question are nested in curly braces? What about control-word-tokens which are not\labelbut have the same meaning - e.g., what about\foobarafter\let\foobar=\label? Must the removal-routine also work in full-expansion-contexts? – Ulrich Diez Feb 18 '19 at 08:47\label{...}is at the beginning of the argument itself. If you're curious, fixing this problem is that intended use. – noibe Feb 18 '19 at 14:58\refstepcounterwhich places an anchor/a destination for hyperlinking when doing\ref? Thus when using hyperref, you may get errors about destinations with same identifier... You may need a command which in the correct way disables every dangerous command and which--when re-stating a theorem--in a local scope sets correct counter values... E.g, setting\labelto\@gobbleisn't the best approach. Should be\def\label#1{\@bsphack\@esphack}... – Ulrich Diez Feb 18 '19 at 15:11\def\label#1{\@bsphack\@esphack}in the code? – noibe Feb 18 '19 at 15:23\refstepcounter-issue in case of loading hyperref and the\def\label#1{\@bsphack\@esphack}-issue are two different problems. In case you wish\labelto be a no-op in whatsoever expansion-context, make sure that that expansion-context is carried out within a local scope/group where\labelis redefined as\def\label#1{\@bsphack\@esphack}. (You can use\renewcommandinstead of\defas well.) In case of using hyperref or the like, you may need to turn a lot of other things, which may cause "destination with same identifier"-errors, into argument-gobbling no-ops, too. – Ulrich Diez Feb 18 '19 at 21:52