i have css gradient like this:
linear-gradient(193deg, rgba(2,0,36,1) 0%, rgba(78,74,64,1) 35%, rgba(0,212,255,1) 100%);
I want to convert it into Swift gradient info like : [colors], angel, [location] using regex. I tried this regex
linear-gradient\([^(]*(\([^)]*\)[^(]*)*[^)]*\)
but still not working https://regex101.com/r/O581sO/1/
My expected output [ 193, [2,0,36,1], 0, [78,74,64,1], 35, [0,212,255,1], 100 ]
CodePudding user response:
Can you try this expression? This should get you what you wanted in groups
linear-gradient\((\d )deg|,\s (?:(?:rgba\((.*?)\)). ?(\d )%)
