Extracting information from a text using Regex and Match in C# .NET

Regex has never been easy for me for some reason :/

Exercises in .NET with Andras Nemes

Occasionally you need to extract some information from a free-text form. Consider the following text:

First name: Elvis
Last name: Presley
Address: 1 Heaven Street
City: Memphis
State: TN
Zip: 12345

Say you need to extract the full name, the address, the city, the state and the zip code into a pipe-delimited string. The following function is one option:

Call the function as follows:

View all posts related to string and text operations here.

View original post

Blog at WordPress.com.

Up ↑