我有一个正则表达式,我正在使用这样
new_regex = /^[+-]?(\d+).*\s+(\d+).*\s+([\d\.]+)/g
>> /^[+-]?(\d+).*\s+(\d+).*\s+([\d\.]+)/g
myregex = new RegExp(new_regex)
>> /^[+-]?(\d+).*\s+(\d+).*\s+([\d\.]+)/g
subject = "+39° 44' 39.28\""
>> "+39° 44' 39.28""
以上适用于我每隔一段时间执行以下操作:
myregex.exec(subject)
>> ["+39° 44' 39.28", "39", "44", "39.28"]
当我第二次执行它时,它给出了 null
myregex.exec(subject)
>> null