This function was incorrectly processing refdeses like "U1000". Change the algorithm to a simpler STL-compatible one and update the tests. Fixes: lp:1813669 * https://bugs.launchpad.net/kicad/+bug/1813669