我有一串数字,每个数字在字符串中可以显示为零或一次.我可以通过RegEx验证吗?我可以做一些像检查字符数组的重复项,但更喜欢坚持我的正常验证例程.
以下应返回"匹配"
String thisItemText = "12679";
if(!thisItemText.matches("[1245679]*")) {
System.out.println("No Match");
} else {
System.out.println("Match");
}
Run Code Online (Sandbox Code Playgroud)
以下应返回"No Match"(注意双"2")
String thisItemText = "122679";
if(!thisItemText.matches("[1245679]*")) {
System.out.println("No Match");
} else {
System.out.println("Match");
}
Run Code Online (Sandbox Code Playgroud) 我正在通过AJAX调用将内容加载到动态添加到DOM的表行中.我在回调函数中调用了datepicker功能,日历显示正常.但是,当我点击日期时,我收到一个错误:inst为null.这是我的代码:
$(document).ready(function() {
$(".edit").live("click", function() {
//Delete previously loaded edit row
$("#tempEditRow").remove();
//Get the record id of the row to be edited
var recordID = $(this).parent("td").parent("tr").attr("id");
//Add the new row to the document
$(this).parent("td").parent("tr").after("<tr id=\"tempEditRow\"><td id=\"tempEditCell\" colspan=\"100\"></td></tr>")
//Get a reference to the new row
var container = $("#tempEditCell");
//Populate the container
populateContainer("/wpm/includes/ajax_editApplication.cfm?id=" + recordID, container);
});
});
function populateContainer(ajaxUrl, container) {
//Populate the container
$.ajax({
url: ajaxUrl,
cache: false,
success: function(html){
$(container).html(html);
$('.datepicker').datepicker();
}
});
}
Run Code Online (Sandbox Code Playgroud)
我已经尝试删除hasDatepicker类,删除对datepicker的任何引用等,但没有任何工作.在此先感谢您的帮助!