Reputation: 13
Is there a way to parse multiple RGB values from a string? In what way should the colours be coded?
Eg.
$string = "foobar [rgb:123abc] some other text and another color: [rgb:ffeecc]"
I want [rgb:xxxxxx]
to be replaced with something like <div style="background: #xxxxxx;"> </div>
Upvotes: 1
Views: 372
Reputation: 490233
You could use this regex to pick up the pattern...
/\[rgb:([0-9a-f]{6})\]/i
Upvotes: 3