본문 바로가기

IT/ETC

REGEX

반응형

ExpressionDescription

[abc] Find any character between the brackets
[^abc] Find any character NOT between the brackets
[0-9] Find any character between the brackets (any digit)
[^0-9] Find any character NOT between the brackets (any non-digit)
(x|y) Find any of the alternatives specified

[ㄱ-ㅎㅏ-ㅣ가-힣] = 한글 포함

 

+ = at least one

* = zero or more

 

 var str = "Hellooo World! Hello W3Schools!"; 
  var patt1 = /lo*/g;
  var result = str.match(patt1);

l,looo,l,l,lo,l

 

? = The n? quantifier matches any string that contains zero or one occurrences of n.

var str = "1, 100 or 1000?";
var patt1 = /10?/g;

1,10,10

 

 

반응형

'IT > ETC' 카테고리의 다른 글

Debugging  (0) 2020.02.14
Android Studio notes1(02/13/20 cudo notes)  (0) 2020.02.13
FCM notification send  (0) 2020.02.11
Regular Expressions  (0) 2020.02.10
es6  (0) 2020.02.10