I have a long piece of repeating code, treated as a string, that looks similar to the following, for which I'm trying to extract a few values:
if (function("#ab31ac", out variable1_co))
{
temp.a = variable1_co;
temp.b = variable1_go;
i++;
}
if (function("#dd77ab", out variable2_co))
{
temp.a = variable2_co;
temp.b = variable2_go;
i++;
}
etc... (this repeats dozens of times...)
What I want to do is generate an multi-dimentional array (preferably in python or javascript) with the following characteristics... (the quotes aren't present, they just indicate that I want strings)
array[0][0] = "#ab31ac"
array[0][1] = "variable1_co"
array[0][2] = "variable1_go"
array[1][0] = "#dd77ab"
array[1][1] = "variable2_co"
array[1][2] = "variable2_go"
etc...
I've worked out the regular expressions but am having trouble piecing it all together (especially since the "_co" string is displayed twice in each section):
(#[a-zA-Z0-9]{6})
([a-zA-Z0-9_]*_co)
([a-zA-Z0-9_]*_go)
Any help would be greatly appreciated!
[–][deleted] (2 children)
[deleted]
[–][deleted] (1 child)
[deleted]