I have a string which could contain several different values, among them are.
EDITED for clarity:
var test could equal FW21002-185 or FW21002-181-0001 or abcdefg or 245-453-654 or FW21002-181-00012
I would like to remove all characters after **and including** the last - only if that string contains four characters after the last dash. So in the above strings examples, the only one that should be changed is the second one to "FW21002-181" All others would remain as they are.
以上就是Remove all characters after last - but only if after - has four characters.的详细内容，更多请关注web前端其它相关文章！