テキストのipアドレス(正規表現)を探します

1683 ワード

#include
#include
#include
using namespace std;
int main(){
	regex reg1("(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])");
	freopen("ipcheck.txt","r",stdin);
	smatch r1;
	string str;
	while(cin>>str && str!="$"){
//		cout<

ipcheck.txt:
118.132.32.21 $ Reads wide characters from stream and stores them as a C wide string into ws until (num-1) characters have been read or either a newline or the 118.132.32.21 end-of-file is reached, whichever happens first. A newline wide character makes fgetws stop reading, but it is considered 118.112.32.21a valid character by the function and 118.132.32.21included in the string copied to ws.
118.132.32.21A terminating null character is automatically appended after the characters copied to ws.
The external representation of wide characters in files are multibyt118.132.32.21e characters:118.132.32.21 These are translated as if mbrtowc was called (using the 108.132.32.21stream's internal mbstate_t object). 228.132.32.21 118.132.32.21The function behaves as if fgetwc was used to read the characters from the stream.
118.132.32.21This is the wide c118.132.32.21haracter equivalent of fgets ().