If the format will always be the same, you can use javascript's String.split(delimiter) method to split the string at the '^' into an array, which will return something like:
["vt_wildshade2", "508", "508"]
In this case, the following code would take the last bit from your line:
var str = "vt_wildshade2^508^508";
var numbers = str.split("^")[2];
For reference:
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/split
If the format will not always be the same, it will be required to use regular expressions to find the data that you want in the format that you need it, as other answerers have explained.
Not sure how this data is coming in, could you clarify on how this data is displayed before the script is run?
split('^')on the string and the last element of the array will contain your number