Problem with using replace() and points

Problem with using replace() and points

Hi there,

I'm pretty new and I hope this hasn't been asked yet, but I was not able to find an answer to my question neither via googeling nor in this forum. I have this problem. I have a string consisting of points and numbers

For example

  1. stringXy = "1.2.1-TaskXY"

What i wand to do is just to get the number part and replace all the dots by underscores. Im trying

  1. stringXy.trim().replace(/./g,'_').substr(0,5);     
However I just get the result "_____". I hope someone has an answer for me. Thanks in advance and

Greetings Chris