I need to extract words that contain digits.
ex:-
Input - 3909B Witmer Road. Niagara Falls. NY 14305
Output - 3909B and 14305
The basic expression should be:
(?<=^| )(?=[^ ]*\d)[^ ]+
(\w*\d[\w\d]+)
And to use it in C#:
var matches = Regex.Matches(input, @"(\w*\d[\w\d]+)");
foreach (Match match in matches){
var word = match.Value;
}
...
var matches = Regex.Matches(input, @"(?<=^| )(?=[^ ]*\d)[^ ]+");
foreach (Match match in matches){
var word = match.Value;
}