regexp_capture.js (2962B)
1 /** 2 * @license Apache-2.0 3 * 4 * Copyright (c) 2021 The Stdlib Authors. 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 'use strict'; 20 21 // MODULES // 22 23 var reWhitespace = require( './main.js' ); 24 25 26 // MAIN // 27 28 /** 29 * Matches a white space character. 30 * 31 * Regular expression: `/([\u0009\u000A\u000B\u000C\u000D\u0020\u0085\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/` 32 * 33 * - `()` 34 * - create a capture group 35 * 36 * - `[]` 37 * - match any one of the listed characters 38 * 39 * - `\u0009` 40 * - character tabulation (horizontal tab; `\t`) 41 * 42 * - `\u000A` 43 * - line feed (LF; `\n`) 44 * 45 * - `\u000B` 46 * - line tabulation (vertical tab; `\v`) 47 * 48 * - `\u000C` 49 * - form feed (`\f`) 50 * 51 * - `\u000D` 52 * - carriage return (CR; `\r`) 53 * 54 * - `\u0020` 55 * - space (most common) 56 * 57 * - `\u0085` 58 * - next line (NEL) 59 * 60 * - `\u00A0` 61 * - non-breaking space 62 * 63 * - `\u1680` 64 * - Ogham space mark 65 * 66 * - `\u2000` 67 * - en quad 68 * 69 * - `\u2001` 70 * - em quad 71 * 72 * - `\u2002` 73 * - en space 74 * 75 * - `\u2003` 76 * - em space 77 * 78 * - `\u2004` 79 * 80 * - three-per-em space (thick space) 81 * 82 * - `\u2005` 83 * - four-per-em space (mid space) 84 * 85 * - `\u2006` 86 * - six-per-em space 87 * 88 * - `\u2007` 89 * - figure space 90 * 91 * - `\u2008` 92 * - punctuation space 93 * 94 * - `\u2009` 95 * - thin space 96 * 97 * - `\u200A` 98 * - hair space 99 * 100 * - `\u2028` 101 * - line separator 102 * 103 * - `\u2029` 104 * - paragraph separator 105 * 106 * - `\u202F` 107 * - narrow no-break space 108 * 109 * - `\u205F` 110 * - medium mathematical space 111 * 112 * - `\u3000` 113 * - ideographic space 114 * 115 * - `\uFEFF` 116 * - zero width non-breaking space 117 * 118 * ## Notes 119 * 120 * - Matches the 25 characters defined as white space ("WSpace=Y","WS") characters in the Unicode 9.0 character database. 121 * - Matches one related white space character without the Unicode character property "WSpace=Y" (zero width non-breaking space which was deprecated as of Unicode 3.2). 122 * 123 * @constant 124 * @type {RegExp} 125 * @default /([\u0009\u000A\u000B\u000C\u000D\u0020\u0085\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/ 126 * @see [whitespace]{@link https://en.wikipedia.org/wiki/Whitespace_character} 127 */ 128 var REGEXP_CAPTURE = reWhitespace({ 129 'capture': true 130 }); 131 132 133 // EXPORTS // 134 135 module.exports = REGEXP_CAPTURE;