從http://compgroups.net/comp.lang.javascript/beginner-how-to-remove-dot-s-and-empty-s/181476我發現刪除空的空間,點就是我一直在尋找,但不能得到我「應該」在使用Javascript號內的iMacros宏
也有許多其他代碼剪嘗試的結果。 :(
希望通過去掉空格&點的 例如>>修改IP八進制修改成「12.34 56 789」:「123456789」
線程上提供的使用正則表達式「答案」:
var strNumber = '12.34.56.789';
strNumber = strNumber.replace(/[^\d]/, '');
或
strNumber = strNumber.replace(/\D/g, '');
心不是我的代碼中工作(使用http://forum.imacros.net/viewtopic.php?f=11&t=19759爲 '模板')。該re是論壇上的其他例子,但遵循這些例子不是解決方案。任何可以工作的代碼都會受到歡迎。我知道有一些不錯的iMacros編碼器...在這裏,希望他們有一個建議
iMacros的VERSION = 2823年2月10日Windows 7的64位
URL GOTO=geoip.hidemyass.com
SET !EXTRACT NULL
TAG POS=1 TYPE=SPAN ATTR=* EXTRACT=TXT
SET ip {{!EXTRACT}}
SET !EXTRACT NULL
SET !VAR8 EVAL(" var strNumber='{{ip}}'; strNumber=strNumber.replace(/\D/g, ''); ")
SET !VAR8 EVAL(" var strNumber='{{ip}}'; strNumber=strNumber.replace(/\D/g, ''); ")
SET !VAR8 EVAL ("strNumber=\'{{ip}}\'; var strNumber = strNumber.replace(/[^\d]/g, ''); ")
PROMPT {{!VAR8}}
的檢查PROMPT總是返回代碼開始的整條生產線在EVAL(「...」)的任何和所有的變化
嘗試這個: 'SET!VAR8 EVAL(「'{{ip}}'。replace(/ \\ s/g,'').replace(/\\./g,''))"> – Shugar
@Shugar哦哇。 ..就像一個魅力...在我的眼睛非常優雅..現在我怎麼給你的最佳解決方案? – user3345612
如果你願意,請在'stackoverflow'上註釋我的評論或任何我的答案;) – Shugar