GitXplorerGitXplorer
w

xregexp

public
7 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
ab6733874fedc4f3d11560f6c1df8bc15639ba35

This project is deprecated.

wwalling committed 13 years ago
Unverified
f2f95f26175953968cf67be8e3771976435f15ce

Fixing problems with NPM package. Fixes #1.

wwalling committed 13 years ago
Unverified
7608c470f960c68290b105e3132f7e359da2452e

Bugfix: npmignore file.

wwalling committed 13 years ago
Unverified
a6a122bec9dc4358c2447fc7aac33c49ec741ef4

Syntax highligted examples.

wwalling committed 13 years ago
Unverified
36a8b6ca9e3c7536b6f0c89d7a1f6188ff0acfec

Update before changing the way the module must be included. Version 1.5.2 (I just stole this version number, because NPM needs an increasing number).

wwalling committed 13 years ago
Unverified
07fc7e1fa67cc54d317a6d592e0b2d170314a410

Updated year in license.

wwalling committed 13 years ago

README

The README file for this repository.

This is XRegExp in a Common JS module. All plugins and unicode packages are included as well. I'm not affiliated with Steven Levithan, the author of XRegExp.

Deprecated

If you use this module, then great, I hope you enjoy it! I just want to tell you that this project is deprecated. In some months it will be replaced by XRegExp v2.0. I invite you to look at it and start using it already, it's quite stable. I was basically just wrapping XRegExp 1.5.x to publish it on NPM. The author Steven Levithan is going to publish NPM packages from v2.0 onwards. You can read the related discussion here.

Be aware that the next release of this module on NPM only accepts require('xregexp').XRegExp when including, for CommonJS compliance. Currently you can do both this and the old way of require('xregexp'). Please change your code to use the new method.

This is what Steven Levithan says about the current XRegExp v2.0 beta:

In the meantime, I recommend that any new projects use the latest beta versions of these packages available here on GitHub. All of the latest betas are now solid/stable enough that I strongly recommend them over the last stable versions (XRegExp v1.5.1, etc.). This is especially so because XRegExp v2.0.0 includes significant API changes. All changes are detailed in the roadmap and in the extensive inline comments within the source files.

– Bjarke Walling, March 26, 2012

Installation

npm install xregexp

Usage example

For JavaScripters:

var XRegExp = require('xregexp').XRegExp;

console.log('Héllö Wôrld'.match(XRegExp('\\p{L}+')));

var date = XRegExp('(?<year>  [0-9]{4})  -?  # year  \n\
                    (?<month> [0-9]{2})  -?  # month \n\
                    (?<day>   [0-9]{2})      # day   ', 'x');
var match = date.exec('2011-06-30');
if (match) {
  console.log(match.day);
}

For CoffeeScripters:

{XRegExp} = require 'xregexp'

console.log 'Héllö Wôrld'.match XRegExp '\\p{L}+'

date = XRegExp '''
  (?<year>  [0-9]{4})  -?  # year
  (?<month> [0-9]{2})  -?  # month
  (?<day>   [0-9]{2})      # day
''', 'x'
match = date.exec '2011-06-30'
console.log match.day if match

Changelog

  • 1.5.3: Fixed problems with NPM package.
  • 1.5.2: Updated to support require("xregexp").XRegExp, which is the future method.
  • 1.5.1: Several bugs fixed and updated to use Unicode 6.1 character database (instead of 5.2).

License

This project includes the software packages:

  • XRegExp 1.5.1
  • XRegExp Unicode plugin base 0.6
  • XRegExp Unicode plugin pack: Categories 1.1
  • XRegExp Unicode plugin pack: Scripts 1.1
  • XRegExp Unicode plugin pack: Blocks 1.1
  • XRegExp Match Recursive plugin 0.1.1

The software is released under the MIT license:

Copyright (c) 2007-2012 Steven Levithan <http://xregexp.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.