<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_52929"> 代码来自于:http://www.zhihu.com/question/24824487<br><br>推荐使用Regexp Match Tracer来测试正则 <div class="blockcode"> <div id="code_k5m"><ol><li>^[0369]*(([147][0369]*|[258][0369]*[258][0369]*)([147][0369]*[258][0369]*)*([258][0369]*|[147][0369]*[147][0369]*)|[258][0369]*[147][0369]*)*$</li></ol></div> <em onclick="copycode($('code_k5m'));">复制代码</em> </div> <img src="http://img.it-home.org/data/attachment/forum/2015pic/20093041_Ox4E.png" alt="使用正则匹配3的倍数 " > </td></tr></table> <div id="comment_52929" class="cm"> </div> <div id="post_rate_div_52929"></div> <br><br>