Looking for a pattern

I am looking for a pattern to match the last underline and its following
string with “####”. for example,

“abc_def_ghi” => “abc_def####”

If I use _.* as the pattern it will replace begin with the first
underline. Which pattern is suite for this case?

thanks.

Zhao Yi wrote:

I am looking for a pattern to match the last underline and its following
string with “####”. for example,

“abc_def_ghi” => “abc_def####”

“abc_def_ghi”.match(/[^]*$/)

That should do the trick, shouldn’t it?

H!

Harald Eilertsen wrote:

Zhao Yi wrote:

I am looking for a pattern to match the last underline and its following
string with “####”. for example,

“abc_def_ghi” => “abc_def####”

“abc_def_ghi”.match(/[^]*$/)

That should do the trick, shouldn’t it?

H!

Yes, very good. thanks.