Run Code
|
API
|
Code Wall
|
Users
|
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
Please
log in
to post a comment.
SQL import
Rank
4647
NeedFirst
if Two Words Are Anagrams of Each Other
IFormatProvider Caveat
multi variable random number generator
D14
Remove xmlns and select signle node
z
Please log in to post a comment.