javascript thread: regular expression to insert spaces into string of characters
> I wish to convert a string of characters (for example,
> actgcattacgcattacggcccccccc)of indefinite length provided by user input
> into groups of three characters separated by spaces (for example, act
gca
> tta cgc att acg gcc ccc ccc).
>
> Can you suggest procedure to use regular expressions to search and
replace
> ?
>
Give this a try:
var s = new String("actgcattacgcattacggcccccccc...");
s = s.replace(/([a-z]{3})/, "$1 ");
|





