forked from niomic-id/javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregExp.js
More file actions
26 lines (18 loc) · 778 Bytes
/
regExp.js
File metadata and controls
26 lines (18 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function panggilRegExp() {
let str = "abcdefghijklmnopqrstuvwxyz";
return str.search(/o/)
}
function flagRegExp() {
let str = "abcdefghijklmnopqrstuvwxyz";
let str2 = "abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz"
console.log("/////////Flag i for Non Case-Sensitive//////////")
console.log(str.search(/K/))
console.log(str.search(/K/i)) //use flag i for Non-case-Sensitive
console.log(str.search(/k/i)) //use flag i for Non-case-Sensitive
console.log("/////////Flag g for search all data string//////////")
console.log(str2.match(/c/g)) //use flag g for search all data string
console.log(str2.match(/c/g)) //use flag g for search all data string
}
console.log(panggilRegExp())
console.log('--------------------------------')
flagRegExp()