특수 문자도 \ 태그를 붙여서 사용할 수 있는듯..
\. 으로 쓰면 . 도 인식할 수 있음.
Try it yourself »
Try it yourself »
JavaScript RegExp [^0-9] Expression
Example
Do a global search for the numbers that are NOT 1 to 4 in a string:
var str = "123456789";
var patt1 = /[^1-4]/g;
var patt1 = /[^1-4]/g;
The marked text below shows where the expression gets a match:
123456789
Try it yourself »
Definition and Usage
The [^0-9] expression is used to find any digit NOT between the brackets.
The digits inside the brackets can be any numbers or span of numbers from 0 to 9.
Tip: Use the [0-9] expression to find any digit between the brackets.
Browser Support
The [^0-9] expression is supported in all major browsers.
Syntax
new RegExp("[^0-9]")
or simply:
/[^0-9]/
or simply:
/[^0-9]/
Syntax with modifiers
new RegExp("[^0-9]","g")
or simply:
/\[^0-9]/g
or simply:
/\[^0-9]/g
More Examples
Example
Do a global search for numbers that are NOT "1" in a string:
var str = "12121212";
var patt1 = /[^1]/g;
var patt1 = /[^1]/g;
The marked text below shows where the expression gets a match:
12121212
Try it yourself »
'개발 > JavaScript' 카테고리의 다른 글
javaScript 정규식 regExp 음수만 입력 가능한 경우 체크하기. (0) | 2014.04.04 |
---|---|
날짜 구하는 js (0) | 2013.12.16 |
[extJs] 드래그 가능한 그리드 설정.///Multiline Row in a Grid (0) | 2013.12.05 |
Javascript의 prototype 제대로 이해하기 (0) | 2013.11.15 |
[스크랩]JQUERY CHECK BOX 관련 기능 정리 (0) | 2013.10.21 |