我需要编辑我的脚本才能获得ref = '521590819123';
正则表达式javascript
怎么样?
<script type="text/javascript">
var ref = "http://www.site.ru/profile/521590819123";
if(ref.indexOf('profile') >= 0) {
ref = String(ref).substr(ref.indexOf('profile'));
}
alert(ref);
</script>
' ref = String(ref).substr(ref.indexOf('profile'));'应该是'ref = String(ref).substr(ref.indexOf('pro文件')+ 8);'as'profile /'长度为8个字符。 – h2ooooooo