How to replace a rgb value with hex value in string using regular expression
<p>I am trying to write a regular expression by which i can replace rgb color value with hex code in a string. The string may have following types :</p>

<pre><code>=&gt; rgb(0, 0, 0) 0 0 0
=&gt; rgb(0 100, 200)
=&gt; 0 0 rgb(201,45,65)
</code></pre>

<p>First i want to access the rgb value from the string and then replace it back with hex code. So result will be :</p>

<pre><code>=&gt; #XXXXXX 0 0 0 
=&gt; #XXXXXX
=&gt; 0 0 #XXXXXX
</code></pre>
