regexp = new RegExp ('(^|\\D)' + number + '\\.(jpg|jpe|jpeg|png)$','i'); if (regexp.test (file))al("yes")