Reputation: 27
word word word word word word word word word word word word word word word word word
insert "&B5&" after every 10 characters, becomes to
word word "&B5&"word word "&B5&"word word "&B5&"word word "&B5&"word word "&B5&"word
How can I do that with Sublime Text 3 or Notepad++ or else? What is the regex find and replace suggestions? Or any other useful way to do it
Upvotes: 1
Views: 615
Reputation: 2604
You can do it using regular expresion, here is an example using vscode: [^.*]{10}
replace all with $0 "&B5&"
output:
word word "&B5&"word word "&B5&"word word "&B5&"word word "&B5&"word word "&B5&"word word "&B5&"word word "&B5&"word word "&B5&"word
note: you can use this regex also for sublime. don't forget to check .* button
or using php:
$input = 'word word word word word word word word word word word word word word word word word';
$input = preg_replace('#([^.*]{10})#', '$1 "&B5&"', $input);
echo $input;
output:
word word "&B5&"word word "&B5&"word word "&B5&"word word "&B5&"word word "&B5&"word word "&B5&"word word "&B5&"word word "&B5&"word
Upvotes: 1