a way to isolate text (or numbers) from a txt-file

Hey peeps!

Kinda new to c++ programming but here goes...

I'm looking for a way (preferably using c++) to search through a large text-document, and isolate patterns of text (like e-mail or phone numbers or whatever) then print the result to a new and hopefully more clean and systematic text-document.

for example, say I have the following in my original text document:

blah balh blah 800-22433224 blah blah cefsa@NOTMAIL.com blah blah blah
blah blah 555-33431145 blah blah@blah.com
randomness blah blah blah more randomness blah 454-66774465

In this instance, lets say my desired output after running the program would be to isolate only the phone numbers and print all these to a text-doc:


What is a good way to go about creating a program that can do this?

I'm mostly interested in learning c++, so any hints or snippets of c++ code would be great!

thanks for reading my first post on cplusplus forums!

I suppose the "proper" way would be regex, but Ive never used it:
Topic archived. No new replies allowed.