using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(\b(?:\w+)?\d+(?:\w+)?(?:[\-\/])?(?:\w+)?(?:\d+)?\b)";
string input = @"Park Avenue number 100
Baker Street number 100
Baker Street 100
The bakery shop is located on 109-111 Wharfside Street
My mother's house is on 40-42 Parkway
My schoolmate lives in 25b-26 Sun Street
The apartment is located on R2-R3 City Quay
I live in 43a Garden Walk
I live in 6/7 Marine Road
I live in 10-12 Acacia Ave
I live in 4513 3RD STREET CIRCLE WEST
I live in 1/2 Fifth Avenue
number C3-H4 sawojajar Malang";
foreach (Match m in Regex.Matches(input, pattern))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx