\begin{quote}
Regular expression for matching \href{https://en.wikipedia.org/wiki/ANSI_escape_code}{\texttt{ ANSI escape codes}} \end{quote}
\hypertarget{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34192}{}\doxysection{$<$/blockquote$>$}\label{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34192}
 {\bfseries{ \href{https://tidelift.com/subscription/pkg/npm-ansi-regex?utm_source=npm-ansi-regex&utm_medium=referral&utm_campaign=readme}{\texttt{ Get professional support for this package with a Tidelift subscription}} }} ~\newline
 \textsubscript{ Tidelift helps make open source sustainable for maintainers while giving companies~\newline
assurances about security, maintenance, and licensing for their dependencies. } 

\DoxyHorRuler{0}
\hypertarget{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34194}{}\doxysection{Install}\label{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34194}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install ansi-\/regex }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34195}{}\doxysection{Usage}\label{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34195}

\begin{DoxyCode}{0}
\DoxyCodeLine{const ansiRegex = require('ansi-\/regex');}
\DoxyCodeLine{}
\DoxyCodeLine{ansiRegex().test('\(\backslash\)u001B[4mcake\(\backslash\)u001B[0m');}
\DoxyCodeLine{//=> true}
\DoxyCodeLine{}
\DoxyCodeLine{ansiRegex().test('cake');}
\DoxyCodeLine{//=> false}
\DoxyCodeLine{}
\DoxyCodeLine{'\(\backslash\)u001B[4mcake\(\backslash\)u001B[0m'.match(ansiRegex());}
\DoxyCodeLine{//=> ['\(\backslash\)u001B[4m', '\(\backslash\)u001B[0m']}
\DoxyCodeLine{}
\DoxyCodeLine{'\(\backslash\)u001B[4mcake\(\backslash\)u001B[0m'.match(ansiRegex(\{onlyFirst: true\}));}
\DoxyCodeLine{//=> ['\(\backslash\)u001B[4m']}
\DoxyCodeLine{}
\DoxyCodeLine{'\(\backslash\)u001B]8;;https://github.com\(\backslash\)u0007click\(\backslash\)u001B]8;;\(\backslash\)u0007'.match(ansiRegex());}
\DoxyCodeLine{//=> ['\(\backslash\)u001B]8;;https://github.com\(\backslash\)u0007', '\(\backslash\)u001B]8;;\(\backslash\)u0007'] }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34196}{}\doxysection{API}\label{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34196}
\hypertarget{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34197}{}\doxysubsection{ansi\+Regex(\mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34197}
Returns a regex for matching ANSI escape codes.\hypertarget{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34198}{}\doxysubsubsection{options}\label{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34198}
\hypertarget{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34199}{}\doxyparagraph{only\+First}\label{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34199}
Type\+: {\ttfamily boolean}~\newline
 Default\+: {\ttfamily false} $\ast$(Matches any ANSI escape codes in a string)$\ast$

Match only the first ANSI escape.\hypertarget{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34200}{}\doxysection{FAQ}\label{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34200}
\hypertarget{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34201}{}\doxysubsection{Why do you test for codes not in the ECMA 48 standard?}\label{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34201}
Some of the codes we run as a test are codes that we acquired finding various lists of non-\/standard or manufacturer specific codes. We test for both standard and non-\/standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-\/standard control codes that do not follow the traditional format (i.\+e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.

On the historical side, those ECMA standards were established in the early 90\textquotesingle{}s whereas the VT100, for example, was designed in the mid/late 70\textquotesingle{}s. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar \textquotesingle{}anarchy\textquotesingle{} of codes is in the x86 architecture for processors; there are a ton of \char`\"{}interrupts\char`\"{} that can mean different things on certain brands of processors, most of which have been phased out.\hypertarget{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34202}{}\doxysection{Security}\label{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34202}
To report a security vulnerability, please use the \href{https://tidelift.com/security}{\texttt{ Tidelift security contact}}. Tidelift will coordinate the fix and disclosure.\hypertarget{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34203}{}\doxysection{Maintainers}\label{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34203}

\begin{DoxyItemize}
\item \href{https://github.com/sindresorhus}{\texttt{ Sindre Sorhus}}
\item \href{https://github.com/qix-}{\texttt{ Josh Junon}}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34204}{}\doxysection{License}\label{md_sfcode_node_modules_wrap_ansi_node_modules_ansi_regex_readme_autotoc_md34204}
MIT 