Uncaught SyntaxError: Unexpected identifier in chrome's console
    var pattern = new RegExp(/^[a-zA-Z0-9_\.\-]+$/);
    if(!pattern.test($(this).val()){
        $('#rlog div.ttc').prop('class','tooltip ttc bad').html('Используйте символы A-Z, a-z и 0-9');
    }

Uncaught SyntaxError: Unexpected identifier on the line in the if.
But there are no mistakes if I write something like this:

    var pattern = new RegExp(/^[a-zA-Z0-9_\.\-]+$/);
    $('#rlog div.ttc').prop('class','tooltip ttc bad').html('Используйте символы A-Z, a-z и 0-9');

I have no idea what the problem is. Hope, you'll help me
Uncaught SyntaxError: Unexpected identifier in chrome's console
===

    var pattern = new RegExp(/^[a-zA-Z0-9_\.\-]+$/);
    if(!pattern.test($(this).val()){
        $('#rlog div.ttc').prop('class','tooltip ttc bad').html('Используйте символы A-Z, a-z и 0-9');
    }

Uncaught SyntaxError: Unexpected identifier on the line in the if.
But there are no mistakes if I write something like this:

    var pattern = new RegExp(/^[a-zA-Z0-9_\.\-]+$/);
    $('#rlog div.ttc').prop('class','tooltip ttc bad').html('Используйте символы A-Z, a-z и 0-9');

I have no idea what the problem is. Hope, you'll help me