Object Properties
Common object properties include the following:
1.global: Whether full-text search, default false
2.ignore Case: Write-sensitive, default is False
3.multiline: Multi-line search, default value is False
4.lastIndex: Is the last character of the current expression matching content
5.source: text string for regular expressions
You can access this property directly in the Reg object:
let reg1 = /\w/let reg2 = /\w/gim // 设置reg属性reg1.global // falsereg1.ignoreCase // falsereg1.multiline // falsereg1.source // "\w"reg2.global // truereg2.ignoreCase // truereg2.multiline // truereg2.source // "\w"
It is worth mentioning that these properties are read-only and you cannot modify their values directly:
reg1.global // falsereg1.global = truereg1.global // false
JS regular expressions from getting started to being buried (8)--regexp Object Properties