Бокс пластиковый для кистей и инструментов (19X7X4 см)<br/>
<button class="one">запустить</button><br/>
<hr>
Бокс пластиковый для кистей и инструментов (19X72X24 см)<br/>
<button class="two">запустить</button><br/>
JavaScript
var test_string_one = 'Бокс пластиковый для кистей и инструментов (19X7X4 см)',
test_string_two = 'Бокс пластиковый для кистей и инструментов (19X72X24 см)',
re = /(\d{1})\s*(x|X|х|Х|×){1}\s*(\d{1})/ig,
replacement = '$1×$3';
// происходит замена только первого символа
$('button.one').on('click', function(){
$(this).after('<br/>'+test_string_one.replace(re, replacement));
});
// происходит замена только первого символа
$('button.two').on('click', function(){
$(this).after('<br/>'+test_string_two.replace(re, replacement));
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.