I would like to create a regex that replaces c# properties in typescript fields:
public int ItemOfferId { get; set; } would become itemOffer: int;
I'm stuck in the first step: I just want to remove the prefix public int and the suffix { get; set; } in a single regex. Expected : ItemOfferId
For the moment I have (public ([a-z]+) (?=([A-Za-z]+))\w+ { get; set; }) which is giving me ItemOfferId in group3 but I wonder how to ignore it, like creating a hole?
public\s*(\w+)\s*(\w+)\s*\{\s*get;\s*set;\s*\}with the following substitution:$2: $1;. This does exactly what you're asking of regex, but I would definitely agree with @TitianCernicova-Dragomir that there is probably a better way to go about this.