Это регулярное выражение поможет вам:
\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b
Измените этот код для ваших конкретных потребностей:
using namespace System::Text::RegularExpressions;
void doTheMatch( String^ inputString, String^ filter )
{
Console::WriteLine( "original string: {0}", inputString );
Console::WriteLine( "attempt to match: {0}", filter );
Regex^ regex = gcnew Regex( filter );
Match^ match = regex->Match( inputString );
if ( ! match->Success )
{
Console::WriteLine(
"Sorry, no match of {0} in {1}", filter, inputString );
return;
}
for ( ; match->Success; match = match->NextMatch() )
{
Console.WriteLine(
"The characters {0} match beginning at position {1}",
match->ToString(), match->Index );
}
}