troubleshooting Question

What is this code doing?

Avatar of Camillia
CamilliaFlag for United States of America asked on
C#
2 Comments1 Solution181 ViewsLast Modified:
I stepped thru this code but still not sure what it'ssupposed to do:
if address1 = "XYZ street"
  Address2 ="ABC street"

This code does some regex and i think it should get XYZ?? What is that match.Success looking for?

Regex _rxFirstToken = new Regex(@"^\s*(?<First>\S+)", RegexOptions.Compiled);
string token = string.Empty;
            Match match = _rxFirstToken.Match(address.Address1 + " " + address.Address2);
 
            if (match.Success)
            {
                token = match.Groups["First"].Value;
            }
 
            return token;
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros