README.md (2029B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # UTF-16 Surrogate Pair 22 23 > [Regular expression][mdn-regexp] to match a [UTF-16][utf-16] surrogate pair. 24 25 <section class="usage"> 26 27 ## Usage 28 29 ```javascript 30 var reUtf16SurrogatePair = require( '@stdlib/regexp/utf16-surrogate-pair' ); 31 ``` 32 33 #### reUtf16SurrogatePair() 34 35 Returns a [regular expression][mdn-regexp] to match a [UTF-16][utf-16] surrogate pair. 36 37 ```javascript 38 var RE_UTF16_SURROGATE_PAIR = reUtf16SurrogatePair(); 39 40 var bool = RE_UTF16_SURROGATE_PAIR.test( 'abc\uD800\uDC00def' ); 41 // returns true 42 ``` 43 44 #### reUtf16SurrogatePair.REGEXP 45 46 [Regular expression][mdn-regexp] to match a [UTF-16][utf-16] surrogate pair. 47 48 ```javascript 49 var bool = reUtf16SurrogatePair.REGEXP.test( 'abc\uD800\uDC00def' ); 50 // returns true 51 ``` 52 53 </section> 54 55 <!-- /.usage --> 56 57 <section class="examples"> 58 59 ## Examples 60 61 <!-- eslint no-undef: "error" --> 62 63 ```javascript 64 var reUtf16SurrogatePair = require( '@stdlib/regexp/utf16-surrogate-pair' ); 65 66 var RE_UTF16_SURROGATE_PAIR = reUtf16SurrogatePair(); 67 68 var bool = RE_UTF16_SURROGATE_PAIR.test( '\uD800\uDC00' ); 69 // returns true 70 71 bool = RE_UTF16_SURROGATE_PAIR.test( 'abc\uD800\uDC00def' ); 72 // returns true 73 74 bool = RE_UTF16_SURROGATE_PAIR.test( 'abc' ); 75 // returns false 76 ``` 77 78 </section> 79 80 <!-- /.examples --> 81 82 <section class="links"> 83 84 [mdn-regexp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions 85 86 [utf-16]: https://en.wikipedia.org/wiki/UTF-16 87 88 </section> 89 90 <!-- /.links -->