728x90
반응형
A regular expression is a sequence of characters that forms a search pattern.
When you search for data in a text, you can use this search pattern to describe what you are searching for.
A regular expression can be a single character, or a more complicated pattern.
Regular expressions can be used to perform all types of text search and text replace operations.
/pattern/modifiers;
String search() With a String
text.search("test");
String search() With a Regular Expression
text.search(/test/i);
String replace() With a String
text.replace("MS", "test");
String replace() With a Regular Expression
text.replace(/microsoft/i, " test ");
Regular Expression Modifiers
Modifier | Description |
i | Perform case-insensitive matching |
g | Perform a global match (find all) |
m | Perform multiline matching |
d | Perform start and end matching |
Regular Expression Patterns
Expression | Description |
[abc] | Find any of the characters between the brackets |
[0-9] | Find any of the digits between the brackets |
(x|y) | Find any of the alternatives separated with | |
728x90
반응형
'JAVASCRIPT' 카테고리의 다른 글
[개발자도구] 크롬 개발자도구 복붙 안 될때 !!!! (3) | 2024.12.18 |
---|---|
20241128_1 Type Conversion (0) | 2024.11.28 |
20241125_1 Loop (12) | 2024.11.25 |
20241122_3 Comparison (4) | 2024.11.22 |
20241122_2 Math Object (0) | 2024.11.22 |