w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
javascript replace all with case insensitive and keeping correct case in original string

Simply use a capturing group:

"Javascript vaja".replace(/(ja)/gi, '<b>$1</b>');

See this working demo.

Edit: Read more about capturing groups here.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.