Due to the fact that tabularx gathers its contents, direct use of \verb would not work. Besides \verb needs one character not in the text to capture. The \detokenize needs a balanced text.
Announcing to the world a capture verbatim macro
The idea is to capture arbitrary characters (assuming however the standard catcodes naturally, else one could set up a loop to set all catcodes) and put it in a macro (not possible with \verb). The syntax is :
\literalset\foo<SPACE>ARBITRARY CHARACTERS<END OF LINE>
Notice that the spaces in the input right before the <END OF LINE>
will not be captured in macro \foo. The <SPACE> at the start
is mandatory and is removed during processing. Spaces not at the very
end of the literal input will be captured.
Code:
\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[margin=.5cm]{geometry}
\usepackage{tabularx}
\makeatletter
% \literalset\foo<SPACE>ARBITRARY CHARACTERS<END OF LINE>
\def\literalset #1{% assumes standard \endlinechar
\begingroup
\def\x{#1}%
\catcode`\^^M 2
\let\do\@makeother
\dospecials
\afterassignment\literalset@i
\toks0=\bgroup }%
\def\literalset@i
{\expandafter\xdef\x{\expandafter\@gobble\the\toks0}\endgroup}
\makeatother
\begin{document}
% I have added a space between \/)? and (www compared to original.
\literalset\foo (https?:\/\/)? (www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)\\
Hello, all is fine here ? I hope so.
\typeout{I AM HERE: \meaning\foo}
\meaning\foo
\begin{table}[htbp]
\centering
\begin{tabularx}{\textwidth}{cX}
\hline
Placeholder&Regular Expression\\
\hline
URL&\texttt{\foo}\\
\hline
\end{tabularx}
\caption{Regular Expressions}
\label{regex}
\end{table}
\end{document}
Notice that the wrapping of very long sequence of such detokenized characters is another issue, one could add now a \printliteral command which would add breakpoints after each character.

Update to add the promised \printliteral command. See the code comments for explanation and context.
\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
%\usepackage[margin=.5cm]{geometry}
\usepackage{tabularx}
\makeatletter
% \literalset\foo<SPACE>ARBITRARY CHARACTERS<END OF LINE>
\def\literalset #1{% assumes standard \endlinechar
\begingroup
\def\x{#1}%
\catcode`\^^M 2
\let\do\@makeother
\dospecials
\afterassignment\literalset@i
\toks0=\bgroup }%
\def\literalset@i
{\expandafter\xdef\x{\expandafter\@gobble\the\toks0}\endgroup}
\makeatother
% TeX has no toggle to tell it to break long words (of random
% characters) automatically when reaching end of line: it goes
% to the right margin and beyond in absence of hyphens and
% spaces if confronted to a non-interrupted sequence of
% characters. And in a \texttt, breaking at hyphens is usually
% inihibited.
% Here is a very simple-minded macro which allows to print a
% \foo which has been declared by \literalset, with automatic
% breaks. More sophisticated treatment is possible (e.g. use
% of discretionaries to allow insertion of continuation
% symbols at breaks).
% We add a little stretch to avoid underfull/overfull boxes.
\makeatletter
\def\printliteral #1{\expandafter\printliteral@i#1\relax }%
\def\printliteral@i #1{\if\relax #1\else\hskip\z@ \@plus .4\p@\relax
#1\expandafter\printliteral@i \fi}
\makeatother
\begin{document}
% I have added a space between \/)? and (www compared to original.
\literalset\foo (https?:\/\/)? (www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)\\
Hello, all is fine here ? I hope so.
\typeout{I AM HERE: \meaning\foo}
\printliteral{\meaning\foo}
\begin{table}[htbp]
\centering
%\begin{tabularx}{\textwidth}{c>{\raggedright\arraybackslash}X}
\begin{tabularx}{\textwidth}{cX}
\hline
Placeholder&Regular Expression\\
\hline
URL&\texttt{\printliteral\foo}\\
\hline
\end{tabularx}
\caption{Regular Expressions}
\label{regex}
\end{table}
%\showoutput
\end{document}
