Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/node_modules/regexpu-core/ |
Upload File : |
# regexpu-core [](https://travis-ci.org/mathiasbynens/regexpu-core) [](https://coveralls.io/r/mathiasbynens/regexpu-core) [](https://gemnasium.com/mathiasbynens/regexpu-core) _regexpu_ is a source code transpiler that enables the use of ES6 Unicode regular expressions in JavaScript-of-today (ES5). _regexpu-core_ contains _regexpu_’s core functionality, i.e. `rewritePattern(pattern, flag)`, which enables rewriting regular expressions that make use of [the ES6 `u` flag](https://mathiasbynens.be/notes/es6-unicode-regex) into equivalent ES5-compatible regular expression patterns. ## Installation To use _regexpu-core_ programmatically, install it as a dependency via [npm](https://www.npmjs.com/): ```bash npm install regexpu-core --save-dev ``` Then, `require` it: ```js const rewritePattern = require('regexpu-core'); ``` ## API This module exports a single function named `rewritePattern`. ### `rewritePattern(pattern, flags)` This function takes a string that represents a regular expression pattern as well as a string representing its flags, and returns an ES5-compatible version of the pattern. ```js rewritePattern('foo.bar', 'u'); // → 'foo(?:[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uD7FF\\uDC00-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF])bar' rewritePattern('[\\u{1D306}-\\u{1D308}a-z]', 'u'); // → '(?:[a-z]|\\uD834[\\uDF06-\\uDF08])' rewritePattern('[\\u{1D306}-\\u{1D308}a-z]', 'ui'); // → '(?:[a-z\\u017F\\u212A]|\\uD834[\\uDF06-\\uDF08])' ``` _regexpu-core_ can rewrite non-ES6 regular expressions too, which is useful to demonstrate how their behavior changes once the `u` and `i` flags are added: ```js // In ES5, the dot operator only matches BMP symbols: rewritePattern('foo.bar'); // → 'foo(?:[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uFFFF])bar' // But with the ES6 `u` flag, it matches astral symbols too: rewritePattern('foo.bar', 'u'); // → 'foo(?:[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uD7FF\\uDC00-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF])bar' ``` `rewritePattern` uses [regjsgen](https://github.com/d10/regjsgen), [regjsparser](https://github.com/jviereck/regjsparser), and [regenerate](https://github.com/mathiasbynens/regenerate) as internal dependencies. ## Author | [](https://twitter.com/mathias "Follow @mathias on Twitter") | |---| | [Mathias Bynens](https://mathiasbynens.be/) | ## License _regexpu-core_ is available under the [MIT](https://mths.be/mit) license.