I have written a console app that reads in a text file full of data.
I had to extract any telephone numbers from it and put them into a results file.
I used several RegEx’s to do this to cover several different formats of telephone numbers i.e. UK, US, international etc.
Here is an example of one I used –
string sPattern = "^\\d{3}-\\d{3}-\\d{4}$";
This would look for telephone numbers in the following format – 123-456-7890
My question being, I now want to write a RegEx that looks for key words as apposed to numbers.
E.g. If I read in a data file I would want it to find key words ‘White’ and ‘Car’.
And then put them into the results file.
Is there a method of doing this?
Try Regex.Matches():