\begin{quote}
Regular expression for matching IP addresses \end{quote}
\hypertarget{md_sfcode_node_modules_ip_regex_readme_autotoc_md12910}{}\doxysection{Install}\label{md_sfcode_node_modules_ip_regex_readme_autotoc_md12910}

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

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

\begin{DoxyCode}{0}
\DoxyCodeLine{const ipRegex = require('ip-\/regex');}
\DoxyCodeLine{}
\DoxyCodeLine{// Contains an IP address?}
\DoxyCodeLine{ipRegex().test('unicorn 192.168.0.1');}
\DoxyCodeLine{//=> true}
\DoxyCodeLine{}
\DoxyCodeLine{// Is an IP address?}
\DoxyCodeLine{ipRegex(\{exact: true\}).test('unicorn 192.168.0.1');}
\DoxyCodeLine{//=> false}
\DoxyCodeLine{}
\DoxyCodeLine{ipRegex.v6(\{exact: true\}).test('1:2:3:4:5:6:7:8');}
\DoxyCodeLine{//=> true}
\DoxyCodeLine{}
\DoxyCodeLine{'unicorn 192.168.0.1 cake 1:2:3:4:5:6:7:8 rainbow'.match(ipRegex());}
\DoxyCodeLine{//=> ['192.168.0.1', '1:2:3:4:5:6:7:8'] }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_ip_regex_readme_autotoc_md12912}{}\doxysection{API}\label{md_sfcode_node_modules_ip_regex_readme_autotoc_md12912}
\hypertarget{md_sfcode_node_modules_ip_regex_readme_autotoc_md12913}{}\doxysubsection{ip\+Regex(\mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_ip_regex_readme_autotoc_md12913}
Returns a regex for matching both IPv4 and IPv6.\hypertarget{md_sfcode_node_modules_ip_regex_readme_autotoc_md12914}{}\doxysubsection{ip\+Regex.\+v4(\mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_ip_regex_readme_autotoc_md12914}
Returns a regex for matching IPv4.\hypertarget{md_sfcode_node_modules_ip_regex_readme_autotoc_md12915}{}\doxysubsection{ip\+Regex.\+v6(\mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_ip_regex_readme_autotoc_md12915}
Returns a regex for matching IPv6.\hypertarget{md_sfcode_node_modules_ip_regex_readme_autotoc_md12916}{}\doxysubsubsection{options.\+exact}\label{md_sfcode_node_modules_ip_regex_readme_autotoc_md12916}
Type\+: {\ttfamily boolean}~\newline
 Default\+: {\ttfamily false} $\ast$(Matches any IP address in a string)$\ast$

Only match an exact string. Useful with {\ttfamily Reg\+Exp\#test()} to check if a string is an IP address.\hypertarget{md_sfcode_node_modules_ip_regex_readme_autotoc_md12917}{}\doxysection{Related}\label{md_sfcode_node_modules_ip_regex_readme_autotoc_md12917}

\begin{DoxyItemize}
\item \href{https://github.com/sindresorhus/is-ip}{\texttt{ is-\/ip}} -\/ Check if a string is an IP address
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_ip_regex_readme_autotoc_md12918}{}\doxysection{License}\label{md_sfcode_node_modules_ip_regex_readme_autotoc_md12918}
MIT © \href{https://sindresorhus.com}{\texttt{ Sindre Sorhus}} 