Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Kumaran-RegText-CityStatePostalCode Parsing
//Rextester.Program.Main is the entry point for your code. Don't change it. //Microsoft (R) Visual C# Compiler version 2.9.0.63208 (958f2354) using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { var inpt = @"Port Washington, CA 922"; var ptrn = @"^([\w\s]+(?:,|\s))\s*(\w{2})\s(\d{3,}$)|^(\w{2})\s(\d{3,}$)"; var rgx = new Regex(ptrn); Match match = rgx.Match(inpt); if (match.Success) { string v = match.Groups[1].Value; Console.WriteLine("Between One and Three: {0}", v); } } } }
run
|
edit
|
history
|
help
0
WDW
sdfghyjuki54efc sacd
never use floats for money
Pascal Tringle
Encryption Practice
ConcurrentStack<T>
Vowel
Binary Search Tree
addr.sin_family == AF_UNSPEC
HelloWorld