Notice
Recent Posts
Recent Comments
Link
250x250
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
27 | 28 | 29 | 30 |
Tags
- npm
- Regular expression
- spring cloud
- Effective Java 3/e
- JavaScript
- regex
- Chunk
- nodejs
- REACTJS
- REACT
- update
- MySQL
- log4j2
- 정규표현식
- 퀵소트
- upgrade
- Webpack
- java
- Effective Java
- spring
- Node
- Spring Batch
- expire_logs_days
- mysql 5.5
- Express
- git
- log_bin
- eslint
- current_date
- migration
Archives
- Today
- Total
내 세상
[React] Regex/정규표현식/Regular Expression 본문
728x90
EX) [2021-12-10][16:04:32] 와 같은 Date에 대괄호가 쳐져있을 때의 처리
대괄호를 제거 하여 내부의 값을 빼어내기 위함.
let splitDate = exampleDate.match(/\[[^\]]*\]/g);
const startDate = splitDate[0].replace(/[\[\]]/g, "");
const startTime = splitDate[1].replace(/[\[\]]/g, "");
위의 예시 [2021-12-10][16:04:32] 를 적용할 경우,
splitDate = [ "[2021-12-01]", "[16:04:32]" ]; // Array
startDate = "2021-12-01";
startTime = "16:04:32";
728x90
'Technical > React' 카테고리의 다른 글
[React] Copy to Clipboard (0) | 2022.11.29 |
---|---|
[React] React Project 초기설정 참고 (0) | 2022.11.22 |
[React] react-contextmenu에서 react-contexify로 변경한 이유 (0) | 2021.04.21 |
[React] React Component/JSX Element to Html (0) | 2021.02.04 |
[React] Dialog 위 Component Focus Setting (0) | 2020.06.09 |