Cordova 联系人插件 ContactFindOptions 过滤器

Cordova Contacts Plugin ContactFindOptions filter

我在使用 cordova 的联系人插件时遇到了一些问题,我想为具有有效 phone 号码的联系人添加过滤器,如何添加正则表达式? javascript 正则表达式似乎不起作用,我需要像 [0-9]

这样的东西
function onDeviceReady() {
    // find all contacts with 'a phone number' in any name field
    var options = new ContactFindOptions();
    options.filter = '6'; // retriev all phones with a 6
    //options.filter = /[0-9]/ doesn't work
    var fields = ["phoneNumbers"];
    options.multiple = true;
    navigator.contacts.find(fields, onSuccess, onError, options);
}

// onSuccess: Get a snapshot of the current contacts

function onSuccess(contacts) {
    alert(contacts.length);
    alert(JSON.stringify(contacts));
}

// onError: Failed to get the contacts

function onError(contactError) {
    alert('onError!');
}

提前致谢!

我意识到他的最新更新现在包括一个选项,可以只获取具有 phone 号码的联系人。选项 id 默认为 false。

options.hasPhoneNumber = true;