{"id":13467398,"url":"https://github.com/atom/node-oniguruma","last_synced_at":"2025-03-26T02:31:22.651Z","repository":{"id":7277472,"uuid":"8591412","full_name":"atom/node-oniguruma","owner":"atom","description":"Oniguruma Node Module","archived":true,"fork":false,"pushed_at":"2022-10-11T23:01:45.000Z","size":1301,"stargazers_count":121,"open_issues_count":27,"forks_count":45,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-02T07:18:00.881Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://atom.github.io/node-oniguruma","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-05T23:15:01.000Z","updated_at":"2024-09-05T21:30:29.000Z","dependencies_parsed_at":"2022-09-04T13:22:17.060Z","dependency_job_id":null,"html_url":"https://github.com/atom/node-oniguruma","commit_stats":null,"previous_names":[],"tags_count":72,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atom%2Fnode-oniguruma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atom%2Fnode-oniguruma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atom%2Fnode-oniguruma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atom%2Fnode-oniguruma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atom","download_url":"https://codeload.github.com/atom/node-oniguruma/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245576529,"owners_count":20638125,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T15:00:55.948Z","updated_at":"2025-03-26T02:31:22.037Z","avatar_url":"https://github.com/atom.png","language":"JavaScript","readme":"##### Atom and all repositories under Atom will be archived on December 15, 2022. Learn more in our [official announcement](https://github.blog/2022-06-08-sunsetting-atom/)\n #### Atom and all repositories under Atom will be archived on December 15, 2022. Learn more in our [official announcement](https://github.blog/2022-06-08-sunsetting-atom/)\n# Oniguruma Node module\n\n[![macOS Build Status](https://travis-ci.org/atom/node-oniguruma.svg?branch=master)](https://travis-ci.org/atom/node-oniguruma)\n[![Windows Build Status](https://ci.appveyor.com/api/projects/status/s9twhi451ef2butr/branch/master?svg=true)](https://ci.appveyor.com/project/Atom/node-oniguruma/branch/master)\n[![Dependency Status](https://david-dm.org/atom/node-oniguruma.svg)](https://david-dm.org/atom/node-oniguruma)\n\nNative Node bindings to the Oniguruma regular expressions library.\n\nRead all about Oniguruma regular expressions [here](https://github.com/kkos/oniguruma/blob/master/doc/RE).\n\nVersion 2.0 of this library added an asynchronous API, the old synchronous\nmethods have been renamed to have a `Sync` suffix.\n\n## Installing\n\n```sh\nnpm install oniguruma\n```\n\n## Building\n  * Clone the repository\n  * Run `npm install`\n  * Run `npm test` to run the specs\n\n## Using\n\n```coffeescript\n{OnigRegExp, OnigScanner} = require 'oniguruma'\n```\n\n### OnigScanner(patterns)\n\nCreate a new scanner with the given patterns.\n\n`patterns` - An array of string patterns.\n\n### OnigScanner::findNextMatch(string, startPosition, callback)\n\nFind the next match from a given position.\n\n`string` - The string to search.\n\n`startPosition` - The optional position to start at, defaults to `0`.\n\n`callback` - The `(error, match)` function to call when done, `match` will\nnull when there is no match.\n\n#### Example\n\n```coffeescript\nscanner = new OnigScanner(['c', 'a(b)?'])\nscanner.findNextMatch 'abc', (error, match) -\u003e\n  console.log match\n  {\n    index: 1,  # Index of the best pattern match\n    captureIndices: [\n      {index: 0, start: 0, end: 2, length: 2},  # Entire match\n      {index: 1, start: 1, end: 2, length: 1}   # Match of first capture group\n    ]\n  }\n```\n\n### OnigScanner::findNextMatchSync(string, startPosition)\n\nSynchronously find the next match from a given position.\n\n`string` - The string to search.\n\n`startPosition` - The optional position to start at, defaults to `0`.\n\nReturns an object containing details about the match or `null` if no match.\n\n#### Example\n\n```coffeescript\nscanner = new OnigScanner(['c', 'a(b)?'])\nmatch = scanner.findNextMatchSync('abc')\nconsole.log match\n{\n  index: 1,  # Index of the best pattern match\n  captureIndices: [\n    {index: 0, start: 0, end: 2, length: 2},  # Entire match\n    {index: 1, start: 1, end: 2, length: 1}   # Match of first capture group\n  ]\n}\n```\n\n### OnigRegExp(pattern)\n\nCreate a new regex with the given pattern.\n\n`pattern` - A string pattern.\n\n### OnigRegExp::search(string, startPosition, callback)\n\nSearch the string for a match starting at the given position.\n\n`string` - The string to search.\n\n`startPosition` - The optional position to start the search at, defaults to `0`.\n\n`callback` - The `(error, match)` function to call when done, `match` will be\nnull if no matches were found. `match` will be an array of objects for each\nmatched group on a successful search.\n\n#### Example\n\n```coffeescript\nregex = new OnigRegExp('a([b-d])c')\nregex.search '!abcdef', (error, match) -\u003e\n  console.log match\n  [\n    {index: 0, start: 1, end: 4, match: 'abc', length: 3}, # Entire match\n    {index: 1, start: 2, end: 3, match: 'b', length: 1}    # Match of first capture group\n  ]\n```\n\n### OnigRegExp::searchSync(string, startPosition)\n\nSynchronously search the string for a match starting at the given position.\n\n`string` - The string to search.\n\n`startPosition` - The optional position to start the search at, defaults to `0`.\n\nReturns an array of objects for each matched group or `null` if no match was\nfound.\n\n#### Example\n\n```coffeescript\nregex = new OnigRegExp('a([b-d])c')\nmatch = regex.searchSync('!abcdef')\nconsole.log match\n[\n  {index: 0, start: 1, end: 4, match: 'abc', length: 3}, # Entire match\n  {index: 1, start: 2, end: 3, match: 'b', length: 1}    # Match of first capture group\n]\n```\n\n### OnigRegExp::test(string, callback)\n\nTest if this regular expression matches the given string.\n\n`string` - The string to test against.\n\n`callback` - The `(error, matches)` function to call when done, `matches` will\nbe `true` if at least one match is found, `false` otherwise.\n\n#### Example\n\n```coffeescript\nregex = new OnigRegExp('a([b-d])c')\nregex.test 'abcdef', (error, matches) -\u003e\n  console.log matches # true\n```\n\n### OnigRegExp::testSync(string)\n\nSynchronously test if this regular expression matches the given string.\n\n`string` - The string to test against.\n\nReturns `true` if at least one match, `false` otherwise.\n\n#### Example\n\n```coffeescript\nregex = new OnigRegExp('a([b-d])c')\nmatches = regex.testSync('abcdef')\nconsole.log matches # true\n```\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatom%2Fnode-oniguruma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatom%2Fnode-oniguruma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatom%2Fnode-oniguruma/lists"}