tiscript regexp quantifiers
От: Antik  
Дата: 11.10.10 08:50
Оценка:
Поддерживается ли {n,m} {m} в RegExp?

В документации вскользь упоминается, но явно не отмечено.

Matches the preceding item 1 or more times. Equivalent to {1,}.

If used immediately after any of the quantifiers *, +, ?, or {}, makes the quantifier non-greedy (matching the minimum number of times), as opposed to the default, which is greedy (matching the maximum number of times).


Или это остатки мануала от старого regexp?

Данный код всегда выводит Error.

var val = "ABK4CKLJWQQF9ROFD9MSM5Y6TK2DVT";
var pattern = /^[0-9a-zA-Z]{30}$/;
if(pattern.test(val)) {
    stdout.println("Success");
} else {
    stdout.println("Error");
}


Убираю {30} и выводит Success.

pattern не правильно написан или просто нет поддержки {} ?
tiscript regexp quantifiers
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.