const regex = /BindableProperty\.Create<[a-zA-Z]+,\s*?([a-zA-Z]+)>\s*?\(\s*?[a-zA-Z]+\s*=\>\s*?[a-zA-Z]+\.([a-zA-Z]*),\s*?([a-zA-Z0-9\s\(\)]+(\.[a-zA-Z]){0,})\)/g;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('BindableProperty\\.Create<[a-zA-Z]+,\\s*?([a-zA-Z]+)>\\s*?\\(\\s*?[a-zA-Z]+\\s*=\\>\\s*?[a-zA-Z]+\\.([a-zA-Z]*),\\s*?([a-zA-Z0-9\\s\\(\\)]+(\\.[a-zA-Z]){0,})\\)', 'g')
const str = `
public static BindableProperty FontStyleProperty =
BindableProperty.Create<Button, FontStyle>(p => p.FontStyle, FontStyle.Regular);
public static BindableProperty DisabledTextColorProperty =
BindableProperty.Create<Button, Color>(p => p.DisabledTextColor, Color.Default);
public static BindableProperty DisabledBackgroundColorProperty =
BindableProperty.Create<Button, Color>(p => p.DisabledBackgroundColor, Color.Default);
public static BindableProperty CornerRadiusProperty =
BindableProperty.Create<Button, Thickness>(p => p.CornerRadius, 0);
public static BindableProperty ImageHeightProperty =
BindableProperty.Create<Button, double>(p => p.ImageHeight, new PointSize(20));
public static BindableProperty BackgroundImageProperty =
BindableProperty.Create<Button, FileImageSource>(p => p.BackgroundImage, null);
public static BindableProperty HighlightedBackgroundImageProperty =
BindableProperty.Create<Button, FileImageSource>(p => p.HighlightedBackgroundImage, null);
public static BindableProperty BackgroundImagePatternProperty =
BindableProperty.Create<Button, FileImageSource>(p => p.BackgroundImagePattern, null);
public static BindableProperty HighlightedBackgroundImagePatternProperty =
BindableProperty.Create<Button, FileImageSource>(p => p.HighlightedBackgroundImagePattern, null);
public static BindableProperty ImageLeftProperty =
BindableProperty.Create<Button, FileImageSource>(p => p.ImageLeft, null);
public static BindableProperty SelectedImageLeftProperty =
BindableProperty.Create<Button, FileImageSource>(p => p.SelectedImageLeft, null);
public static BindableProperty ImageTopProperty =
BindableProperty.Create<Button, FileImageSource>(p => p.ImageTop, null);
public static BindableProperty ImageRightProperty =
BindableProperty.Create<Button, FileImageSource>(p => p.ImageRight, null);
public static BindableProperty ImageBottomProperty =
BindableProperty.Create<Button, FileImageSource>(p => p.ImageBottom, null);
public static BindableProperty SelectedImageRightProperty =
BindableProperty.Create<Button, FileImageSource>(p => p.SelectedImageRight, null);
public static BindableProperty PaddingProperty =
BindableProperty.Create<Button, Thickness>(p => p.Padding, 0);//DefaultPadding);
public static BindableProperty TextPaddingProperty =
BindableProperty.Create<Button, Thickness>(p => p.TextPadding, DefaultTextPadding);
public static BindableProperty ImageRightHeightProperty =
BindableProperty.Create<Button, double>(p => p.ImageRightHeight, Double.NaN);
public static BindableProperty ImageRightWidthProperty =
BindableProperty.Create<Button, double>(p => p.ImageRightWidth, Double.NaN);
public static BindableProperty ImageLeftHeightProperty =
BindableProperty.Create<Button, double>(p => p.ImageLeftHeight, Double.NaN);
public static BindableProperty ImageLeftWidthProperty =
BindableProperty.Create<Button, double>(p => p.ImageLeftWidth, Double.NaN);
public static BindableProperty TiltEnabledProperty =
BindableProperty.Create<Button, bool>(p => p.TiltEnabled, false);
public static BindableProperty CenterImageProperty =
BindableProperty.Create<Button, bool>(p => p.CenterImage, false);
public static BindableProperty RefitTextEnabledProperty =
BindableProperty.Create<Button, bool>(p => p.RefitTextEnabled, false);
public static BindableProperty MinimumFontSizeProperty =
BindableProperty.Create<Button, double>(p => p.MinimumFontSize, new PointSize(8));
public static BindableProperty TextLineBreakModeProperty =
BindableProperty.Create<Button, LineBreakMode>(p => p.TextLineBreakMode, LineBreakMode.MiddleTruncation);
public static BindableProperty XAlignProperty =
BindableProperty.Create<Button, Xamarin.Forms.TextAlignment>(p => p.XAlign, Xamarin.Forms.TextAlignment.Center);
public static BindableProperty YAlignProperty =
BindableProperty.Create<Button, Xamarin.Forms.TextAlignment>(p => p.YAlign, Xamarin.Forms.TextAlignment.Center);
public static BindableProperty BorderlessProperty =
BindableProperty.Create<Button, bool>(p => p.Borderless, false);`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions