"함수 preg split()"의 두 판 사이의 차이

 
(같은 사용자의 중간 판 2개는 보이지 않습니다)
1번째 줄: 1번째 줄:
==개요==
==개요==
[[분류: 정규표현식]]
{{DISPLAYTITLE:함수 preg_split()}}
{{DISPLAYTITLE:함수 preg_split()}}
;함수 preg_split()
;함수 preg_split()
29번째 줄: 30번째 줄:
{{참고|JavaScript split()}}
{{참고|JavaScript split()}}
<syntaxhighlight lang='JavaScript' run>
<syntaxhighlight lang='JavaScript' run>
console.log( 'a1bc2c5d3e4f'.split(/[0-9]/) );
console.log( 'aaa1bbb2ccc'.split(/[0-9]/) );
</syntaxhighlight>
</syntaxhighlight>


36번째 줄: 37번째 줄:
{{참고|PHP preg_split()}}
{{참고|PHP preg_split()}}
<syntaxhighlight lang='php' run>
<syntaxhighlight lang='php' run>
$keywords = preg_split('/[0-9]/', 'a1bc2c5d3e4f');
$keywords = preg_split('/[0-9]/', 'aaa1bbb2ccc');
print_r($keywords);
print_r($keywords);
</syntaxhighlight>
</syntaxhighlight>

2023년 9월 29일 (금) 15:49 기준 최신판

1 개요[ | ]

함수 preg_split()

2 같이 보기[ | ]

3 C++[ | ]

#include <iostream>
#include <vector>
#include <regex>
using namespace std;

int main() {
    string in = "aaa1bbb2ccc";
    regex rx("[0-9]");
    sregex_token_iterator iter(in.begin(), in.end(), rx, -1), end;
    vector<string> strs{iter, end};
    for (string s: strs) cout << s << ' '; // aaa bbb ccc 
}

4 JavaScript[ | ]

console.log( 'aaa1bbb2ccc'.split(/[0-9]/) );

5 PHP[ | ]

$keywords = preg_split('/[0-9]/', 'aaa1bbb2ccc');
print_r($keywords);
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}