I am trying to generate C# Properties by using regex out of question names. I have more than 100 and task is likely to be repeated so it's worth putting effort into it.
Strings to be converted:
Do you own your property?
How is it owned?
Relationship to other registered owner
Estimated value of Estate (joint)
Address Line 1
Are any of the children under 18 years old?
Are you interested in safeguarding your assets for your children/beneficiaries?
Expected outcome:
public string DoYouOwnYourProperty { get; set;}
public string HowIsItOwned { get; set;}
public string RelationshipToOtherRegisteredOwner { get; set;}
public string EstimatedValueOfEstateJoint { get; set;}
public string AddressLine1 { get; set;}
public string AreAnyOfTheChildrenUnder18YearsOld { get; set;}
public string AreYouInterestedInSafeguardingYourAssetsForYourChildrenBeneficiaries { get; set;}
I was snooping around and found flavours of regex questions where they would remove special chars or would UpperCase it in code but not do both with regex only.
([a-zA-z])( [a-zA-z])([a-zA-z])
Replace:
\1\U2\3
However group 2 does not get upper-cased, and I am not sure how to append public string
and { get; set;}
for everything and not per group.