# Regex and lookahead to specific number of chars

**URL:** <https://www.ruby-forum.com/t/regex-and-lookahead-to-specific-number-of-chars/130151>\
**Category:** Ruby\
**Created:** [February 25, 2008, 9:28pm UTC](https://www.ruby-forum.com/t/regex-and-lookahead-to-specific-number-of-chars/130151 "2008-02-25T21:28:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [February 25, 2008, 9:28pm UTC](https://www.ruby-forum.com/t/regex-and-lookahead-to-specific-number-of-chars/130151/1 "2008-02-25T21:28:44Z")

</div>

If I have a string such as  
“I love ruby, i really do love ruby, oh yes i do blah blah blah”

and i want to insert an asterix at every 10th char whether its a  
whitespace, digit whatever how do i go about it

i was trying

string.gsub!(/[.]{10}/, “\*”)

but it doesnt work

any hints???
