repos: 207630174
This data as json
id | node_id | name | full_name | private | owner | html_url | description | fork | created_at | updated_at | pushed_at | homepage | size | stargazers_count | watchers_count | language | has_issues | has_projects | has_downloads | has_wiki | has_pages | forks_count | archived | disabled | open_issues_count | license | topics | forks | open_issues | watchers | default_branch | permissions | temp_clone_token | organization | network_count | subscribers_count | readme | readme_html | allow_forking | visibility | is_template | template_repository | web_commit_signoff_required | has_discussions |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
207630174 | MDEwOlJlcG9zaXRvcnkyMDc2MzAxNzQ= | datasette-rure | simonw/datasette-rure | 0 | 9599 | https://github.com/simonw/datasette-rure | Datasette plugin that adds a custom SQL function for executing matches using the Rust regular expression engine | 0 | 2019-09-10T18:09:33Z | 2020-12-04T04:26:53Z | 2019-09-11T22:59:38Z | 19 | 4 | 4 | Python | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | apache-2.0 | ["sqlite", "regular-expressions", "datasette", "datasette-plugin", "datasette-io"] | 0 | 0 | 4 | master | {"admin": false, "push": false, "pull": false} | 0 | 1 | # datasette-rure [](https://pypi.org/project/datasette-rure/) [](https://circleci.com/gh/simonw/datasette-rure) [](https://github.com/simonw/datasette-rure/blob/master/LICENSE) Datasette plugin that adds a custom SQL function for executing matches using the Rust regular expression engine Install this plugin in the same environment as Datasette to enable the `regexp()` SQL function. $ pip install datasette-rure The plugin is built on top of the [rure-python](https://github.com/davidblewett/rure-python) library by David Blewett. ## regexp() to test regular expressions You can test if a value matches a regular expression like this: select regexp('hi.*there', 'hi there') -- returns 1 select regexp('not.*there', 'hi there') -- returns 0 You can also use SQLite's custom syntax to run matches: select 'hi there' REGEXP 'hi.*there' -- returns 1 This means you can select rows based on regular expression matches - for example, to select every article where the title begins with an E or an F: select * from articles where title REGEXP '^[EF]' Try this out: [REGEXP interactive demo](https://datasette-rure-demo.datasette.io/24ways?sql=select+*+from+articles+where+title+REGEXP+%27%5E%5BEF%5D%27) ## regexp_match() to extract groups You can extract captured subsets of a pattern using `regexp_match()`. select regexp_match('.*( and .*)', title) as n from articles where n is not null -- Returns the ' and X' component of any matching titles, e.g. -- and Recognition -- and Transitions Their Place -- etc This will return the first parenthesis match when called with two arguments. You can call it with three arguments to indicate which match you would like to extract: select regexp_match('.*(and)(.*)', title, 2) as n from articles where n is not null The function will return `null` for invalid inputs e.g. a pattern without capture groups. Try this out: [regexp_match() interactive demo](https://datasette-rure-demo.datasette.io/24ways?sql=select+%27WHY+%27+%7C%7C+regexp_match%28%27Why+%28.*%29%27%2C+title%29+as+t+from+articles+where+t+is+not+null) ## regexp_matches() to extract multiple matches at once The `regexp_matches()` function can be used to extract multiple patterns from a single string. The result is returned as a JSON array, which can then be further processed using SQLite's [JSON functions](https://www.sqlite.org/json1.html). The first argument is a regular expression with named capture groups. The second argument is the string to be matched. select regexp_matches( 'hello (?P<name>\w+) the (?P<species>\w+)', 'hello bob the dog, hello maggie the cat, hello tarquin the otter' ) This will return a list of JSON objects, each one representing the named captures from the original regular expression: [ {"name": "bob", "species": "dog"}, {"name": "maggie", "species": "cat"}, {"name": "tarquin", "species": "otter"} ] Try this out: [regexp_matches() interactive demo](https://datasette-rure-demo.datasette.io/24ways?sql=select+regexp_matches%28%0D%0A++++%27hello+%28%3FP%3Cname%3E%5Cw%2B%29+the+%28%3FP%3Cspecies%3E%5Cw%2B%29%27%2C%0D%0A++++%27hello+bob+the+dog%2C+hello+maggie+the+cat%2C+hello+tarquin+the+otter%27%0D%0A%29) | <div id="readme" class="md" data-path="README.md"><article class="markdown-body entry-content container-lg" itemprop="text"><h1><a id="user-content-datasette-rure" class="anchor" aria-hidden="true" href="#user-content-datasette-rure"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>datasette-rure</h1> <p><a href="https://pypi.org/project/datasette-rure/" rel="nofollow"><img src="https://camo.githubusercontent.com/71217f9bd1b366cef0b2c8147af82aa94cac531801f86b277bb0bf3b1d13c1c1/68747470733a2f2f696d672e736869656c64732e696f2f707970692f762f6461746173657474652d727572652e737667" alt="PyPI" data-canonical-src="https://img.shields.io/pypi/v/datasette-rure.svg" style="max-width:100%;"></a> <a href="https://circleci.com/gh/simonw/datasette-rure" rel="nofollow"><img src="https://camo.githubusercontent.com/bc58494132e2732aabfe5f64284366a785e96850c5b5b86962a9d94d06f61489/68747470733a2f2f636972636c6563692e636f6d2f67682f73696d6f6e772f6461746173657474652d727572652e7376673f7374796c653d737667" alt="CircleCI" data-canonical-src="https://circleci.com/gh/simonw/datasette-rure.svg?style=svg" style="max-width:100%;"></a> <a href="https://github.com/simonw/datasette-rure/blob/master/LICENSE"><img src="https://camo.githubusercontent.com/1698104e976c681143eb0841f9675c6f802bb7aa832afc0c7a4e719b1f3cf955/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d417061636865253230322e302d626c75652e737667" alt="License" data-canonical-src="https://img.shields.io/badge/license-Apache%202.0-blue.svg" style="max-width:100%;"></a></p> <p>Datasette plugin that adds a custom SQL function for executing matches using the Rust regular expression engine</p> <p>Install this plugin in the same environment as Datasette to enable the <code>regexp()</code> SQL function.</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="$ pip install datasette-rure "><pre><code>$ pip install datasette-rure </code></pre></div> <p>The plugin is built on top of the <a href="https://github.com/davidblewett/rure-python">rure-python</a> library by David Blewett.</p> <h2><a id="user-content-regexp-to-test-regular-expressions" class="anchor" aria-hidden="true" href="#user-content-regexp-to-test-regular-expressions"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>regexp() to test regular expressions</h2> <p>You can test if a value matches a regular expression like this:</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="select regexp('hi.*there', 'hi there') -- returns 1 select regexp('not.*there', 'hi there') -- returns 0 "><pre><code>select regexp('hi.*there', 'hi there') -- returns 1 select regexp('not.*there', 'hi there') -- returns 0 </code></pre></div> <p>You can also use SQLite's custom syntax to run matches:</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="select 'hi there' REGEXP 'hi.*there' -- returns 1 "><pre><code>select 'hi there' REGEXP 'hi.*there' -- returns 1 </code></pre></div> <p>This means you can select rows based on regular expression matches - for example, to select every article where the title begins with an E or an F:</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="select * from articles where title REGEXP '^[EF]' "><pre><code>select * from articles where title REGEXP '^[EF]' </code></pre></div> <p>Try this out: <a href="https://datasette-rure-demo.datasette.io/24ways?sql=select+*+from+articles+where+title+REGEXP+%27%5E%5BEF%5D%27" rel="nofollow">REGEXP interactive demo</a></p> <h2><a id="user-content-regexp_match-to-extract-groups" class="anchor" aria-hidden="true" href="#user-content-regexp_match-to-extract-groups"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>regexp_match() to extract groups</h2> <p>You can extract captured subsets of a pattern using <code>regexp_match()</code>.</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="select regexp_match('.*( and .*)', title) as n from articles where n is not null -- Returns the ' and X' component of any matching titles, e.g. -- and Recognition -- and Transitions Their Place -- etc "><pre><code>select regexp_match('.*( and .*)', title) as n from articles where n is not null -- Returns the ' and X' component of any matching titles, e.g. -- and Recognition -- and Transitions Their Place -- etc </code></pre></div> <p>This will return the first parenthesis match when called with two arguments. You can call it with three arguments to indicate which match you would like to extract:</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="select regexp_match('.*(and)(.*)', title, 2) as n from articles where n is not null "><pre><code>select regexp_match('.*(and)(.*)', title, 2) as n from articles where n is not null </code></pre></div> <p>The function will return <code>null</code> for invalid inputs e.g. a pattern without capture groups.</p> <p>Try this out: <a href="https://datasette-rure-demo.datasette.io/24ways?sql=select+%27WHY+%27+%7C%7C+regexp_match%28%27Why+%28.*%29%27%2C+title%29+as+t+from+articles+where+t+is+not+null" rel="nofollow">regexp_match() interactive demo</a></p> <h2><a id="user-content-regexp_matches-to-extract-multiple-matches-at-once" class="anchor" aria-hidden="true" href="#user-content-regexp_matches-to-extract-multiple-matches-at-once"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>regexp_matches() to extract multiple matches at once</h2> <p>The <code>regexp_matches()</code> function can be used to extract multiple patterns from a single string. The result is returned as a JSON array, which can then be further processed using SQLite's <a href="https://www.sqlite.org/json1.html" rel="nofollow">JSON functions</a>.</p> <p>The first argument is a regular expression with named capture groups. The second argument is the string to be matched.</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="select regexp_matches( 'hello (?P<name>\w+) the (?P<species>\w+)', 'hello bob the dog, hello maggie the cat, hello tarquin the otter' ) "><pre><code>select regexp_matches( 'hello (?P<name>\w+) the (?P<species>\w+)', 'hello bob the dog, hello maggie the cat, hello tarquin the otter' ) </code></pre></div> <p>This will return a list of JSON objects, each one representing the named captures from the original regular expression:</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="[ {"name": "bob", "species": "dog"}, {"name": "maggie", "species": "cat"}, {"name": "tarquin", "species": "otter"} ] "><pre><code>[ {"name": "bob", "species": "dog"}, {"name": "maggie", "species": "cat"}, {"name": "tarquin", "species": "otter"} ] </code></pre></div> <p>Try this out: <a href="https://datasette-rure-demo.datasette.io/24ways?sql=select+regexp_matches%28%0D%0A++++%27hello+%28%3FP%3Cname%3E%5Cw%2B%29+the+%28%3FP%3Cspecies%3E%5Cw%2B%29%27%2C%0D%0A++++%27hello+bob+the+dog%2C+hello+maggie+the+cat%2C+hello+tarquin+the+otter%27%0D%0A%29" rel="nofollow">regexp_matches() interactive demo</a></p> </article></div> |
Links from other tables
- 3 rows from repo in releases