Socket
Socket
Sign inDemoInstall

xregexp

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xregexp - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

src/addons/build.js

46

package.json
{
"name": "xregexp",
"version": "3.0.0",
"description": "Extended regular expressions",
"homepage": "http://xregexp.com/",
"author": "Steven Levithan <steves_list@hotmail.com>",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/slevithan/xregexp.git"
},
"keywords": [
"regex",
"regexp"
],
"main": "xregexp-all.js",
"files": [
"LICENSE",
"xregexp-all.js"
],
"scripts": {
"build": "./tools/concatenate-source.sh"
}
"name": "xregexp",
"version": "3.1.0",
"description": "Extended regular expressions",
"homepage": "http://xregexp.com/",
"author": "Steven Levithan <steves_list@hotmail.com>",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/slevithan/xregexp.git"
},
"keywords": [
"regex",
"regexp"
],
"main": "./src/index.js",
"files": [
"src"
],
"scripts": {
"build": "browserify src/index.js --standalone XRegExp > xregexp-all.js"
},
"devDependencies": {
"browserify": "^12.0.1"
}
}

@@ -1,5 +0,5 @@

[XRegExp](http://xregexp.com/) 3.0.0
[XRegExp](http://xregexp.com/) 3.1.0
====================================
XRegExp provides augmented and extensible JavaScript regular expressions. You get new syntax, flags, and methods beyond what browsers support natively. XRegExp is also a regex utility belt with tools to make your client-side grepping simpler and more powerful, while freeing you from worrying about pesky cross-browser inconsistencies and things like manually manipulating `lastIndex` or slicing strings when tokenizing.
XRegExp provides augmented (and extensible) JavaScript regular expressions. You get new modern syntax and flags beyond what browsers support natively. XRegExp is also a regex utility belt with tools to make your client-side grepping and parsing easier, while freeing you from worrying about pesky aspects of JavaScript regexes like cross-browser inconsistencies and manually manipulating `lastIndex`.

@@ -43,11 +43,2 @@ XRegExp supports all native ES6 regular expression syntax. It supports Internet Explorer 5.5+, Firefox 1.5+, Chrome, Safari 3+, and Opera 11+. You can also use it with Node.js, or as a RequireJS module. The base library is about 4.25 KB, minified and gzipped.

// If you want, you can extend native methods so you don't have to worry about this.
// Doing so also fixes numerous browser bugs in the native methods
XRegExp.install('natives');
'2015-02-22'.replace(date, '${month}/${day}/${year}'); // -> '02/22/2015'
'2015-02-22'.replace(date, function(match) {
return match.month + '/' + match.day + '/' + match.year;
}); // -> '02/22/2015'
date.exec('2015-02-22').year; // -> '2015'
// Extract every other digit from a string using XRegExp.forEach

@@ -83,3 +74,3 @@ var evens = [];

You can either load addons individually, or bundle all addons together with XRegExp by loading `xregexp-all.js`. XRegExp's [npm](http://npmjs.org/) package uses `xregexp-all.js`, so addons are always available when XRegExp is installed using npm.
You can either load addons individually, or bundle all addons together with XRegExp by loading `xregexp-all.js`. XRegExp's [npm package](https://www.npmjs.com/package/xregexp) uses `xregexp-all.js`, so addons are always available when XRegExp is installed using npm.

@@ -111,11 +102,15 @@ ### Unicode

By default, `\p{…}` and `\P{…}` support the Basic Multilingual Plane (i.e. code points up to `U+FFFF`). You can opt-in to full 21-bit Unicode support (with code points up to `U+10FFFF`) on a per-regex basis by using flag `A`. In XRegExp, this is called *astral mode*. You can automatically apply astral mode for all new regexes by running `XRegExp.install('astral')`. When in astral mode, `\p{…}` and `\P{…}` always match a full code point rather than a code unit, using surrogate pairs for code points above `U+FFFF`.
By default, `\p{…}` and `\P{…}` support the Basic Multilingual Plane (i.e. code points up to `U+FFFF`). You can opt-in to full 21-bit Unicode support (with code points up to `U+10FFFF`) on a per-regex basis by using flag `A`. In XRegExp, this is called *astral mode*. You can automatically add flag `A` for all new regexes by running `XRegExp.install('astral')`. When in astral mode, `\p{…}` and `\P{…}` always match a full code point rather than a code unit, using surrogate pairs for code points above `U+FFFF`.
```js
// Using flag A. The test string uses a surrogate pair to represent U+1F4A9
XRegExp('^\\pS$', 'A').test('\uD83D\uDCA9'); // -> true
// Using flag A to match astral code points
XRegExp('^\\pS$').test('💩'); // -> false
XRegExp('^\\pS$', 'A').test('💩'); // -> true
XRegExp('(?A)^\\pS$').test('💩'); // -> true
// Using surrogate pair U+D83D U+DCA9 to represent U+1F4A9 (pile of poo)
XRegExp('(?A)^\\pS$').test('\uD83D\uDCA9'); // -> true
// Implicit flag A
XRegExp.install('astral');
XRegExp('^\\pS$').test('\uD83D\uDCA9'); // -> true
XRegExp('^\\pS$').test('💩'); // -> true
```

@@ -185,3 +180,3 @@

// Omitting unneeded parts with null valueNames, and using escapeChar
str = '...{1}\\{{function(x,y){return y+x;}}';
str = '...{1}.\\{{function(x,y){return {y:x}}}';
XRegExp.matchRecursive(str, '{', '}', 'g', {

@@ -192,6 +187,6 @@ valueNames: ['literal', null, 'value', null],

/* -> [
{name: 'literal', value: '...', start: 0, end: 3},
{name: 'value', value: '1', start: 4, end: 5},
{name: 'literal', value: '\\{', start: 6, end: 8},
{name: 'value', value: 'function(x,y){return y+x;}', start: 9, end: 35}
{name: 'literal', value: '...', start: 0, end: 3},
{name: 'value', value: '1', start: 4, end: 5},
{name: 'literal', value: '.\\{', start: 6, end: 9},
{name: 'value', value: 'function(x,y){return {y:x}}', start: 10, end: 37}
] */

@@ -221,3 +216,3 @@

Using [npm](http://npmjs.org/):
Using [npm](https://www.npmjs.com/):

@@ -233,3 +228,2 @@ ```bash

```
The [CommonJS](http://wiki.commonjs.org/wiki/Modules)-style `require('xregexp').XRegExp` also works.

@@ -244,19 +238,14 @@ In an AMD loader like [RequireJS](http://requirejs.org/):

## Changelog
* Releases: [Version history](http://xregexp.com/history/).
* Upcoming: [Issue tracker](https://github.com/slevithan/xregexp/issues).
## About
XRegExp copyright 2007-2015 by [Steven Levithan](http://stevenlevithan.com/).
XRegExp copyright 2007-2016 by [Steven Levithan](http://stevenlevithan.com/).
Tools: Unicode range generators by [Mathias Bynens](http://mathiasbynens.be/), and adapted from his [unicode-data](https://github.com/mathiasbynens/unicode-data) project. Source file concatenator by [Bjarke Walling](http://twitter.com/walling).
Tools: Unicode range generators by [Mathias Bynens](http://mathiasbynens.be/), and adapted from his [unicode-data](https://github.com/mathiasbynens/unicode-data) project.
Tests: Uses [Jasmine](http://pivotal.github.com/jasmine/) for unit tests, and [Benchmark.js](http://benchmarkjs.com) for performance tests.
Tests: Uses [Jasmine](http://jasmine.github.io/) for unit tests, and [Benchmark.js](http://benchmarkjs.com) for performance tests.
Prior art: `XRegExp.build` inspired by [Lea Verou](http://lea.verou.me/)'s [RegExp.create](http://lea.verou.me/2011/03/create-complex-regexps-more-easily/). `XRegExp.union` inspired by [Ruby](http://www.ruby-lang.org/). XRegExp's syntax extensions and flags come from [Perl](http://www.perl.org/), [.NET](http://www.microsoft.com/net), etc.
All code, including addons, tools, and tests, is released under the terms of the [MIT License](http://mit-license.org/).
All code, including addons, tools, and tests, is released under the terms of the [MIT](http://mit-license.org/) license.
Fork me to show support, fix, and extend.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc