You would need to take up the rail / gripper, trim back the fray and buy a length of soft timber 3/4 cms wide depending on how much you have to trim back, and about 1cm thick, fold the edges of the carpet and tack if wooden floor, or use a strong adhesive for timber and carpet, and if you have it, a little varnish on the timber to finish off. bit of a bodge job but will tidy it up. dont buy the timber to thick or your door won't close.