WEB+DB PRESS Vol.6
���W3 �u�Z�L�����e�B���� Web�A�v���P�[�V�����J���ҁv
�E��4�́uJSP/�T�[�u���b�g�ɂ�����Z�L�����e�B�v
143�y�[�W�A���X�g2�u���K�\���ɂ�镶����`�F�b�N�v��18�s�ڂɂ����āA��
�p�p�������ǂ������`�F�b�N���˂Ȃ�Ȃ��Ƃ�����A���p�����݂̂����`�F�b
�N���Ă���܂���ł����B�������͎��̂悤�ɂȂ�܂��i�Ԏ��̍s�������ӏ��ł��j�B
package webdb;
import org.apache.oro.text.perl.Perl5Util;
public class StrChkLib {
Perl5Util util = new Perl5Util();
// �����`�F�b�N
public boolean numberCheck(String str) {
if (util.match("/^[1-9][0-9]+$/", str)) {
return true;
} else {
return false;
}
}
// ���p�p���`�F�b�N
public boolean numberCheck(String str) {
if (util.match("/^[0-9][A-Za-z]+$",str)){
return true;
} else {
return false;
}
}
// �X�֔ԍ��t�H�[�}�b�g�`�F�b�N
public boolean zipFormatCheck(String str) {
if (util.match("/^[0-9]{3}-[0-9]{4}$/", str)) {
return true;
} else {
return false;
}
}
// ���[���A�h���X�`�F�b�N
public boolean mailAddressCheck(String str) {
if (util.match("/^[A-Za-z0-9.\\-_]+@([A-Za-z0-9.\\-]+)$/", str)) {
String domainstr = util.group(1);
if (domainstr.indexOf(".") != -1
&& domainstr.startsWith(".") == false
&& domainstr.endsWith(".") == false
&& domainstr.startsWith("-") == false
&& domainstr.endsWith("-") == false
&& util.match("/\\.\\./", domainstr) == false
&& util.match("/-\\./", domainstr) == false
&& util.match("/\\.-/", domainstr) == false ) {
return true;
} else {
return false;
}
} else {
return false;
}
}
}