Link to home
Start Free TrialLog in
Avatar of Camillia
CamilliaFlag for United States of America

asked on

What is this code doing?

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;

Open in new window

SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial