Description
This regex will match only streets with N, S, E, W followed by whitespace and more text or the end of the line.
^([nsew])\b(?:\s.*?)?$
- Group 0 will receive the entire matched value
Group 1 will receive just the N, S, E, or W
N Wisconsin Drive S Voter Booth E Kitten Ave W Washington Street Noghtington Lane Silver Stone Drive Edans Expressway Wireware Waythrough
Example
You didn't specify a language, so I picked PHP to demo the regex.
<?php
$sourcestring="N Wisconsin Drive
S Voter Booth
E Kitten Ave
W Washington Street
Noghtington Lane
Silver Stone Drive
Edans Expressway
Wireware Waythrough";
Dim re As Regex = New Regex("^([nsew])\b(?:\s.*?)?$",RegexOptions.IgnoreCase OR RegexOptions.Multiline)
Dim mc as MatchCollection = re.Matches(sourcestring)
Dim mIdx as Integer = 0
For each m as Match in mc
For groupIdx As Integer = 0 To m.Groups.Count - 1
Console.WriteLine("[{0}][{1}] = {2}", mIdx, re.GetGroupNames(groupIdx), m.Groups(groupIdx).Value)
Next
mIdx=mIdx+1
Next
End Sub
End Module
$matches Array:
(
[0] => Array
(
[0] => N Wisconsin Drive
[1] => S Voter Booth
[2] => E Kitten Ave
[3] => W Washington Street
)
[1] => Array
(
[0] => N
[1] => S
[2] => E
[3] => W
)
)