1
0
mirror of https://github.com/pdemian/human2regex.git synced 2025-05-15 20:10:19 -07:00

Updated code, Readme, and tutorial. Cleaned up HTML.

This commit is contained in:
Patrick Demian 2020-11-13 03:57:28 -05:00
parent 7f516ec33b
commit 436dbe3c40
26 changed files with 2465 additions and 8487 deletions

View File

@ -11,4 +11,4 @@ script:
- npm t - npm t
after_success: after_success:
- npm run extract - npm run codecov

View File

@ -1,4 +1,20 @@
# Human2Regex # Human2Regex
<div align="center">
![H2R logo](./src/docs/favicon-small.png)
[![Build Status](https://travis-ci.org/pdemian/human2regex.svg?branch=master)](https://travis-ci.org/pdemian/human2regex)
![Codecov](https://codecov.io/gh/pdemian/human2regex/branch/master/graphs/badge.svg?branch=master)
![GitHub](https://img.shields.io/github/license/pdemian/human2regex)
[![Website](https://img.shields.io/badge/website-pdemian.github.io/human2regex-blue)](https://pdemian.github.io/human2regex/)
[![Docs](https://img.shields.io/badge/docs-API-blue)](API.md)
[![Docs](https://img.shields.io/badge/docs-language-blue)](https://pdemian.github.io/human2regex/tutorial.html)
<!-- ![npm](https://img.shields.io/npm/v/human2regex) -->
</div>
## Purpose ## Purpose
Generate regular expressions from natural language. Generate regular expressions from natural language.
@ -14,7 +30,7 @@ Is the former not much easier to read and bug fix than the latter?
Running the program should result in the following output: Running the program should result in the following output:
Your regex = /(?<capture_me>[\w\.\=\-]*\w++)/g Your regex = /(?<capture_me>[\w\.\=\-]*\w+)/g
You can then use your regex in your language of choice, with Human2Regex validating your regex for you. You can then use your regex in your language of choice, with Human2Regex validating your regex for you.
@ -74,6 +90,10 @@ Human2Regex is available as an embeddable API.
The API reference is available [here](API.md) The API reference is available [here](API.md)
## Usage ## Usage
Prebuild
npm install
Build Build
npm run build npm run build
@ -89,5 +109,4 @@ Test
## Todo ## Todo
- Return CommonError rather than requiring the user to convert to a CommonError - Return CommonError rather than requiring the user to convert to a CommonError
- Move to yarn/npm
- Add more regex options such as back references, subroutines, lookahead/behind, and more character classes (eg, `[:alpha:]`) - Add more regex options such as back references, subroutines, lookahead/behind, and more character classes (eg, `[:alpha:]`)

View File

@ -1 +1 @@
<!DOCTYPE html><html lang="en" dir="ltr"><head><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="description" content="Not Found"><meta name="keywords" content="Human2Regex, Human, Regex, Natural, Language, Natural Language"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Error 404 - Not Found</title><link href="bundle.min.css" rel="stylesheet" type="text/css"><meta name="theme-color" content="#212529"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="default"><link rel="icon" type="image/x-icon" href="favicon.ico"></head><body><a class="skip skip-top" href="#maincontent">Skip to main content</a><div class="wrapper"><nav class="navbar navbar-expand-lg navbar-light fixed-top" id="mainNav"><div class="container"><a class="navbar-brand" href="index.html"><img src="favicon.png" width="30" height="30" class="d-inline-block align-top" alt="logo">&nbsp;Human2Regex</a></div></nav><div class="container" id="maincontent" role="main"><div class="masthead"><div class="overlay"></div><div class="container"><div class="align_header"><div class="mx-auto"><div class="site-heading"><h1>404</h1><span class="subheading">Not Found</span></div></div></div></div></div><br><br><br><div class="row"><div class="col-12 mx-auto"><h3 class="align_header">The resource could not be found.</h3></div></div></div><footer><div class="container"><div class="row"><div class="col-lg-8 col-md-10 mx-auto"><p class="copyright">Copyright &copy; 2020 Patrick Demian. This page's source code is available at <a rel="noopener noreferrer" href="https://github.com/pdemian/human2regex">github.com/pdemian/human2regex</a></p></div></div></div></footer></div><script defer="defer" src="bundle.min.js"></script></body></html> <!DOCTYPE html><html lang="en" dir="ltr"><head><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="description" content="Not Found"><meta name="keywords" content="Human2Regex, Human, Regex, Natural, Language, Natural Language"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Error 404 - Not Found</title><link href="bundle.min.css" rel="stylesheet" type="text/css"><meta name="theme-color" content="#212529"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="default"><link rel="icon" type="image/x-icon" href="favicon.ico"></head><body><a class="skip skip-top" href="#maincontent">Skip to main content</a><div class="wrapper"><nav class="navbar navbar-expand-lg navbar-light fixed-top" id="mainNav"><div class="container"><a class="navbar-brand" href="index.html"><img src="favicon-small.png" width="30" height="30" class="d-inline-block align-top" alt="logo">&nbsp;Human2Regex</a></div></nav><div class="container" id="maincontent" role="main"><div class="masthead"><div class="overlay"></div><div class="container"><div class="align_header"><div class="mx-auto"><div class="site-heading"><h1>404</h1><span class="subheading">Not Found</span></div></div></div></div></div><br><br><br><div class="row"><div class="col-12 mx-auto"><h3 class="align_header">The resource could not be found.</h3></div></div></div><footer><div class="container"><div class="row"><div class="col-lg-8 col-md-10 mx-auto"><p class="copyright">Copyright &copy; 2020 Patrick Demian. This page's source code is available at <a rel="noopener noreferrer" href="https://github.com/pdemian/human2regex">github.com/pdemian/human2regex</a></p></div></div></div></footer></div><script defer="defer" src="bundle.min.js"></script></body></html>

4
docs/bundle.min.css vendored

File diff suppressed because one or more lines are too long

6
docs/bundle.min.js vendored

File diff suppressed because one or more lines are too long

BIN
docs/favicon-small.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en" dir="ltr"><head><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="description" content="Create regular expressions with natural, human language"><meta name="keywords" content="Human2Regex, Human, Regex, Natural, Language, Natural Language"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Human2Regex</title><link href="bundle.min.css" rel="stylesheet" type="text/css"><meta name="theme-color" content="#212529"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="default"><link rel="icon" type="image/x-icon" href="favicon.ico"></head><body><a class="skip skip-top" href="#maincontent">Skip to main content</a><div class="wrapper"><nav class="navbar navbar-expand-lg navbar-light fixed-top" id="mainNav"><div class="container"><a class="navbar-brand" href="index.html"><img src="favicon.png" width="30" height="30" class="d-inline-block align-top" alt="logo">&nbsp;Human2Regex</a></div></nav><div class="container" id="maincontent" role="main"><div class="row"><div class="col-lg-8 tenpx-margin-bottom"><div class="form-group row zero-margin-bottom"><label for="dialect" class="col-sm-4 col-form-label">Regex dialect:</label><div class="col-sm-8"><select class="form-control" id="dialect"><option value="js" selected="selected">Javascript</option><option value="dotnet">.NET</option><option value="java">Java</option><option value="pcre">PCRE</option></select></div></div><h4>Your Regular Expression:</h4><div class="row"><div class="col-xl-11 tenpx-margin-bottom"><input readonly="readonly" class="form-control" id="regex"></div><div class="col-xl-1"><button type="button" class="btn btn-secondary float-right" id="clip">Copy</button></div></div><h4>Human Speak:</h4><textarea class="form-control" id="human" rows="25"> <!DOCTYPE html><html lang="en" dir="ltr"><head><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="description" content="Create regular expressions with natural, human language"><meta name="keywords" content="Human2Regex, Human, Regex, Natural, Language, Natural Language"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Human2Regex</title><link href="bundle.min.css" rel="stylesheet" type="text/css"><meta name="theme-color" content="#212529"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="default"><link rel="icon" type="image/x-icon" href="favicon.ico"></head><body><a class="skip skip-top" href="#maincontent">Skip to main content</a><div class="wrapper"><nav class="navbar navbar-expand-lg navbar-light fixed-top" id="mainNav"><div class="container"><a class="navbar-brand" href="index.html"><img src="favicon-small.png" width="30" height="30" class="d-inline-block align-top" alt="logo">&nbsp;Human2Regex</a></div></nav><div class="container" id="maincontent" role="main"><div class="row"><div class="col-lg-8 tenpx-margin-bottom"><div class="form-group row zero-margin-bottom"><label for="dialect" class="col-sm-4 col-form-label">Regex dialect:</label><div class="col-sm-8"><select class="form-control" id="dialect"><option value="js" selected="selected">Javascript</option><option value="dotnet">.NET</option><option value="java">Java</option><option value="pcre">PCRE</option></select></div></div><h4>Your Regular Expression:</h4><div class="row"><div class="col-xl-11 tenpx-margin-bottom"><input readonly="readonly" class="form-control" id="regex"></div><div class="col-xl-1"><button type="button" class="btn btn-secondary float-right" id="clip">Copy</button></div></div><h4>Human Speak:</h4><textarea class="form-control" id="human" rows="25">
// H2R supports // # and /**/ as comments // H2R supports // # and /**/ as comments
// A group is only captured if given a name. // A group is only captured if given a name.
// You can use "and", "or", "not" to specify "[]" regex // You can use "and", "or", "not" to specify "[]" regex
@ -37,4 +37,4 @@ create an optional group
# fragment, again, we don't care, so ignore everything afterwards # fragment, again, we don't care, so ignore everything afterwards
match "#" match "#"
match 0+ any thing match 0+ any thing
</textarea><h4>Errors:</h4><textarea readonly="readonly" class="form-control" id="errors" rows="5"></textarea></div><br><div class="col-lg-4 tenpx-margin-bottom"><div class="cheatsheet"><h2>Cheat Sheet:</h2><p>Full documentation available <a href="tutorial.html">here</a></p><p class="font-weight-bold">Matching</p><p><code class="cm-s-idea">match "hello world"</code> matches "hello world" exactly</p><p></p><p><code class="cm-s-idea">match "hello" then optionally " world"</code> matches "hello" or "hello world"</p><p><code class="cm-s-idea">match "hello" or "world"</code> matches "hello" or "world</p><p><code class="cm-s-idea">match a word</code> matches any word</p><p class="font-weight-bold">Repetition</p><p><code class="cm-s-idea">match 0+ "hello"</code> matches 0 or more "hello"s</p><p><code class="cm-s-idea">match 3 "hello"</code> matches exactly "hellohellohello"</p><p><code class="cm-s-idea">match 1 to 5 "hello"</code> matches between 1 to 5 "hello"s</p><p><code class="cm-s-idea">repeat 0 or more</code> repeats the intended text 0 or more times (default)</p><p><code class="cm-s-idea">optionally repeat between 3 to 5</code> optionally repeats the indented text 3 to 5 times</p><p class="font-weight-bold">Grouping</p><p><code class="cm-s-idea">create a group called "mygroup"</code> creates a group called "mygroup"</p><p><code class="cm-s-idea">create an optional group</code> creates an unnamed optional group</p></div></div></div></div><footer><div class="container"><div class="row"><div class="col-lg-8 col-md-10 mx-auto"><p class="copyright">Copyright &copy; 2020 Patrick Demian. This page's source code is available at <a rel="noopener noreferrer" href="https://github.com/pdemian/human2regex">github.com/pdemian/human2regex</a></p></div></div></div></footer></div><script defer="defer" src="bundle.min.js"></script></body></html> </textarea><h4>Errors:</h4><textarea readonly="readonly" class="form-control" id="errors" rows="5"></textarea></div><br><div class="col-lg-4 tenpx-margin-bottom"><div class="cheatsheet"><h2>Cheat Sheet:</h2><p>Full documentation available <a href="tutorial.html">here</a></p><p class="font-weight-bold">Matching</p><p><code class="cm-s-idea">match "hello world"</code> matches "hello world" exactly</p><p></p><p><code class="cm-s-idea">match "hello" then optionally " world"</code> matches "hello" or "hello world"</p><p><code class="cm-s-idea">match "hello" or "world"</code> matches "hello" or "world</p><p><code class="cm-s-idea">match a word</code> matches any word</p><p class="font-weight-bold">Repetition</p><p><code class="cm-s-idea">match 0+ "hello"</code> matches 0 or more "hello"s</p><p><code class="cm-s-idea">match 3 "hello"</code> matches exactly "hellohellohello"</p><p><code class="cm-s-idea">match 1 to 5 "hello"</code> matches between 1 to 5 "hello"s</p><p><code class="cm-s-idea">repeat 0 or more</code> repeats the intended text 0 or more times (default)</p><p><code class="cm-s-idea">optionally repeat between 3 to 5</code> optionally repeats the indented text 3 to 5 times</p><p class="font-weight-bold">Grouping</p><p><code class="cm-s-idea">create a group called mygroup</code> creates a group called "mygroup"</p><p><code class="cm-s-idea">create an optional group</code> creates an unnamed optional group</p></div></div></div></div><footer><div class="container"><div class="row"><div class="col-lg-8 col-md-10 mx-auto"><p class="copyright">Copyright &copy; 2020 Patrick Demian. This page's source code is available at <a rel="noopener noreferrer" href="https://github.com/pdemian/human2regex">github.com/pdemian/human2regex</a></p></div></div></div></footer></div><script defer="defer" src="bundle.min.js"></script></body></html>

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAA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chevrotain_1.EmbeddedActionsParser {
{ ALT: () => { { ALT: () => {
$.CONSUME(T.To); $.CONSUME(T.To);
const val = $.SUBRULE3(NumberSubStatement); const val = $.SUBRULE3(NumberSubStatement);
return new TokenAndValue(val.token, [val.value, null]); const opt = $.OPTION7(() => {
return $.OR5([
{ ALT: () => {
tokens.push($.CONSUME2(T.Inclusive));
return "inclusive";
} },
{ ALT: () => {
tokens.push($.CONSUME2(T.Exclusive));
return "exclusive";
} }
]);
});
return new TokenAndValue(val.token, [val.value, opt]);
} } } }
]); ]);
tokens.push(to.token); tokens.push(to.token);

View File

@ -1 +1 @@
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAS5D,gBAAgB,CAAC,eAAO,MAAM,IAAI,gCAAgD,CAAC;AACnF,gBAAgB,CAAC,eAAO,MAAM,GAAG,gCAA8C,CAAC;AAChF,gBAAgB,CAAC,eAAO,MAAM,GAAG,gCAA8C,CAAC;AAChF,gBAAgB,CAAC,eAAO,MAAM,KAAK,gCAAkD,CAAC;AACtF,gBAAgB,CAAC,eAAO,MAAM,IAAI,gCAAgD,CAAC;AACnF,gBAAgB,CAAC,eAAO,MAAM,IAAI,gCAAgD,CAAC;AACnF,gBAAgB,CAAC,eAAO,MAAM,GAAG,gCAA8C,CAAC;AAChF,gBAAgB,CAAC,eAAO,MAAM,KAAK,gCAAkD,CAAC;AACtF,gBAAgB,CAAC,eAAO,MAAM,KAAK,gCAAkD,CAAC;AACtF,gBAAgB,CAAC,eAAO,MAAM,IAAI,gCAAgD,CAAC;AACnF,gBAAgB,CAAC,eAAO,MAAM,GAAG,gCAA8C,CAAC;AAEhF,gBAAgB,CAAC,eAAO,MAAM,QAAQ,gCAA2E,CAAC;AAClH,gBAAgB,CAAC,eAAO,MAAM,KAAK,gCAAuD,CAAC;AAC3F,gBAAgB,CAAC,eAAO,MAAM,IAAI,gCAAgD,CAAC;AACnF,gBAAgB,CAAC,eAA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;AAClH,gBAAgB,CAAC,eAAO,MAAM,eAAe,gCAAuE,CAAC;AACrH,gBAAgB,CAAC,eAAO,MAAM,aAAa,gCAAmE,CAAC;AAC/G,gBAAgB,CAAC,eAAO,MAAM,MAAM,gCAAwD,CAAC;AAuB7F,gBAAgB,CAAC,eAAO,MAAM,SAAS,gCAA4C,CAAC;AACpF,gBAAgB,CAAC,eAAO,MAAM,EAAE,gCAAgH,CAAC;AACjJ,gBAAgB,CAAC,eAAO,MAAM,iBAAiB,gCAAwF,CAAC;AACxI,gBAAgB,CAAC,eAAO,MAAM,gBAAgB,gCAA4G,CAAC;AAE3J,gBAAgB,CAAC,eAAO,MAAM,UAAU,gCAA0D,CAAC;AACnG,gBAAgB,CAAC,eAAO,MAAM,aAAa,gCAAyD,CAAC;AACrG,gBAAgB,CAAC,eAAO,MAAM,aAAa,gCAA+G,CAAC;AAE3J,gBAAgB,CAAC,eAAO,MAAM,MAAM,gCAAgC,CAAC;AACrE,gBAAgB,CAAC,eAAO,MAAM,OAAO,gCAAiC,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,SAAS,kCA0ErB,CAAC"}

View File

@ -47,7 +47,7 @@ const chevrotain_1 = require("chevrotain");
/** @internal */ exports.Inclusive = chevrotain_1.createToken({ name: "Inclusive", pattern: /inclusive(ly)?/i }); /** @internal */ exports.Inclusive = chevrotain_1.createToken({ name: "Inclusive", pattern: /inclusive(ly)?/i });
/** @internal */ exports.Exclusive = chevrotain_1.createToken({ name: "Exclusive", pattern: /exclusive(ly)?/i }); /** @internal */ exports.Exclusive = chevrotain_1.createToken({ name: "Exclusive", pattern: /exclusive(ly)?/i });
/** @internal */ exports.From = chevrotain_1.createToken({ name: "From", pattern: /from/i }); /** @internal */ exports.From = chevrotain_1.createToken({ name: "From", pattern: /from/i });
/** @internal */ exports.To = chevrotain_1.createToken({ name: "To", pattern: /(to|through|thru|\-|\.\.|\.\.\.)/i }); /** @internal */ exports.To = chevrotain_1.createToken({ name: "To", pattern: /(to|through|thru|\-|\.\.\.?)/i });
/** @internal */ exports.Create = chevrotain_1.createToken({ name: "Create", pattern: /create(s)?/i }); /** @internal */ exports.Create = chevrotain_1.createToken({ name: "Create", pattern: /create(s)?/i });
/** @internal */ exports.Called = chevrotain_1.createToken({ name: "Called", pattern: /name(d)?|call(ed)?/i }); /** @internal */ exports.Called = chevrotain_1.createToken({ name: "Called", pattern: /name(d)?|call(ed)?/i });
/** @internal */ exports.Repeat = chevrotain_1.createToken({ name: "Repeat", pattern: /repeat(s|ing)?/i }); /** @internal */ exports.Repeat = chevrotain_1.createToken({ name: "Repeat", pattern: /repeat(s|ing)?/i });

120
package-lock.json generated
View File

@ -1363,6 +1363,12 @@
"integrity": "sha512-X1Iui3FUNZP18EUvysTHxt+Avu2nlVzyf90YM8OYgP6SGzTzzX/0JgObfO1AQQDzuZtNNz29bVh8h5R97JrjxA==", "integrity": "sha512-X1Iui3FUNZP18EUvysTHxt+Avu2nlVzyf90YM8OYgP6SGzTzzX/0JgObfO1AQQDzuZtNNz29bVh8h5R97JrjxA==",
"dev": true "dev": true
}, },
"@tootallnate/once": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz",
"integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==",
"dev": true
},
"@types/anymatch": { "@types/anymatch": {
"version": "1.3.1", "version": "1.3.1",
"resolved": "https://registry.npmjs.org/@types/anymatch/-/anymatch-1.3.1.tgz", "resolved": "https://registry.npmjs.org/@types/anymatch/-/anymatch-1.3.1.tgz",
@ -1910,6 +1916,15 @@
"integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==",
"dev": true "dev": true
}, },
"agent-base": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
"integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
"dev": true,
"requires": {
"debug": "4"
}
},
"aggregate-error": { "aggregate-error": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz",
@ -2019,6 +2034,12 @@
"sprintf-js": "~1.0.2" "sprintf-js": "~1.0.2"
} }
}, },
"argv": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/argv/-/argv-0.0.2.tgz",
"integrity": "sha1-7L0W+JSbFXGDcRsb2jNPN4QBhas=",
"dev": true
},
"arr-diff": { "arr-diff": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz",
@ -2888,6 +2909,19 @@
"q": "^1.1.2" "q": "^1.1.2"
} }
}, },
"codecov": {
"version": "3.8.1",
"resolved": "https://registry.npmjs.org/codecov/-/codecov-3.8.1.tgz",
"integrity": "sha512-Qm7ltx1pzLPsliZY81jyaQ80dcNR4/JpcX0IHCIWrHBXgseySqbdbYfkdiXd7o/xmzQpGRVCKGYeTrHUpn6Dcw==",
"dev": true,
"requires": {
"argv": "0.0.2",
"ignore-walk": "3.0.3",
"js-yaml": "3.14.0",
"teeny-request": "6.0.1",
"urlgrey": "0.4.4"
}
},
"codemirror": { "codemirror": {
"version": "5.58.2", "version": "5.58.2",
"resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.58.2.tgz", "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.58.2.tgz",
@ -5186,6 +5220,17 @@
"uglify-js": "^3.5.1" "uglify-js": "^3.5.1"
} }
}, },
"http-proxy-agent": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz",
"integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==",
"dev": true,
"requires": {
"@tootallnate/once": "1",
"agent-base": "6",
"debug": "4"
}
},
"http-signature": { "http-signature": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
@ -5203,6 +5248,24 @@
"integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=",
"dev": true "dev": true
}, },
"https-proxy-agent": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz",
"integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==",
"dev": true,
"requires": {
"agent-base": "5",
"debug": "4"
},
"dependencies": {
"agent-base": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz",
"integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==",
"dev": true
}
}
},
"human-signals": { "human-signals": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz",
@ -5245,6 +5308,15 @@
"integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==",
"dev": true "dev": true
}, },
"ignore-walk": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.3.tgz",
"integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==",
"dev": true,
"requires": {
"minimatch": "^3.0.4"
}
},
"import-fresh": { "import-fresh": {
"version": "3.2.1", "version": "3.2.1",
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz",
@ -8655,6 +8727,12 @@
"lower-case": "^1.1.1" "lower-case": "^1.1.1"
} }
}, },
"node-fetch": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==",
"dev": true
},
"node-int64": { "node-int64": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz",
@ -10945,6 +11023,15 @@
"stream-shift": "^1.0.0" "stream-shift": "^1.0.0"
} }
}, },
"stream-events": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/stream-events/-/stream-events-1.0.5.tgz",
"integrity": "sha512-E1GUzBSgvct8Jsb3v2X15pjzN1tYebtbLaMg+eBOUOAxgbLoSbT2NS91ckc5lJD1KfLjId+jXJRgo0qnV5Nerg==",
"dev": true,
"requires": {
"stubs": "^3.0.0"
}
},
"stream-http": { "stream-http": {
"version": "2.8.3", "version": "2.8.3",
"resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz", "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz",
@ -11116,6 +11203,12 @@
"integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
"dev": true "dev": true
}, },
"stubs": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/stubs/-/stubs-3.0.0.tgz",
"integrity": "sha1-6NK6H6nJBXAwPAMLaQD31fiavls=",
"dev": true
},
"stylehacks": { "stylehacks": {
"version": "4.0.3", "version": "4.0.3",
"resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-4.0.3.tgz", "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-4.0.3.tgz",
@ -11246,6 +11339,27 @@
"yallist": "^4.0.0" "yallist": "^4.0.0"
} }
}, },
"teeny-request": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-6.0.1.tgz",
"integrity": "sha512-TAK0c9a00ELOqLrZ49cFxvPVogMUFaWY8dUsQc/0CuQPGF+BOxOQzXfE413BAk2kLomwNplvdtMpeaeGWmoc2g==",
"dev": true,
"requires": {
"http-proxy-agent": "^4.0.0",
"https-proxy-agent": "^4.0.0",
"node-fetch": "^2.2.0",
"stream-events": "^1.0.5",
"uuid": "^3.3.2"
},
"dependencies": {
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true
}
}
},
"terminal-link": { "terminal-link": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz", "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz",
@ -11976,6 +12090,12 @@
} }
} }
}, },
"urlgrey": {
"version": "0.4.4",
"resolved": "https://registry.npmjs.org/urlgrey/-/urlgrey-0.4.4.tgz",
"integrity": "sha1-iS/pWWCAXoVRnxzUOJ8stMu3ZS8=",
"dev": true
},
"use": { "use": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz",

View File

@ -1,6 +1,6 @@
{ {
"name": "human2regex", "name": "human2regex",
"version": "0.9.6", "version": "0.9.7",
"description": "Humanized Regular Expressions", "description": "Humanized Regular Expressions",
"main": "./lib/index.js", "main": "./lib/index.js",
"typings": "./lib/index.d.ts", "typings": "./lib/index.d.ts",
@ -12,6 +12,7 @@
"@typescript-eslint/eslint-plugin": "^4.6.1", "@typescript-eslint/eslint-plugin": "^4.6.1",
"@typescript-eslint/parser": "^4.6.1", "@typescript-eslint/parser": "^4.6.1",
"before-build-webpack": "^0.2.9", "before-build-webpack": "^0.2.9",
"codecov": "^3.8.1",
"copy-webpack-plugin": "^6.3.0", "copy-webpack-plugin": "^6.3.0",
"css-loader": "^4.3.0", "css-loader": "^4.3.0",
"eslint": "^7.11.0", "eslint": "^7.11.0",
@ -32,6 +33,7 @@
"scripts": { "scripts": {
"build": "tsc && webpack --config webpack.config.js", "build": "tsc && webpack --config webpack.config.js",
"test": "eslint && jest", "test": "eslint && jest",
"codecov": "codecov",
"prepare": "npm run build", "prepare": "npm run build",
"prepublishOnly": "npm t" "prepublishOnly": "npm t"
}, },

8038
src/docs/bootstrap.css vendored

File diff suppressed because it is too large Load Diff

View File

@ -6,22 +6,22 @@
body { body {
font-size: 20px; font-size: 20px;
color: #212529 color: #212529;
} }
p { p {
line-height: 1.5 line-height: 1.5;
} }
p a { p a {
text-decoration: underline text-decoration: underline;
} }
@media (max-width:575px) { @media (max-width:575px) {
.form-inline .form-control { .form-inline .form-control {
display: inline-block; display: inline-block;
width: auto; width: auto;
vertical-align: middle vertical-align: middle;
} }
.form-inline label { .form-inline label {
display: -ms-flexbox; display: -ms-flexbox;
@ -30,7 +30,7 @@ p a {
align-items: center; align-items: center;
-ms-flex-pack: center; -ms-flex-pack: center;
justify-content: center; justify-content: center;
margin-bottom: 0 margin-bottom: 0;
} }
.form-inline .form-group { .form-inline .form-group {
display: -ms-flexbox; display: -ms-flexbox;
@ -41,7 +41,7 @@ p a {
flex-flow: row wrap; flex-flow: row wrap;
-ms-flex-align: center; -ms-flex-align: center;
align-items: center; align-items: center;
margin-bottom: 0 margin-bottom: 0;
} }
} }
@ -52,58 +52,58 @@ h4,
h5, h5,
h6 { h6 {
font-weight: 800; font-weight: 800;
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
} }
::-moz-selection { ::-moz-selection {
color: #fff; color: #fff;
background: #0085a1; background: #0085a1;
text-shadow: none text-shadow: none;
} }
::selection { ::selection {
color: #fff; color: #fff;
background: #0085a1; background: #0085a1;
text-shadow: none text-shadow: none;
} }
#mainNav { #mainNav {
position: absolute; position: absolute;
border-bottom: 1px solid transparent; border-bottom: 1px solid transparent;
background-color: #232323; background-color: #232323;
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
} }
#mainNav .navbar-brand { #mainNav .navbar-brand {
font-weight: 800; font-weight: 800;
color: #fff color: #fff;
} }
@media only screen and (max-width:991px) { @media only screen and (max-width:991px) {
#mainNav { #mainNav {
position: fixed position: fixed;
} }
} }
@media only screen and (min-width:992px) { @media only screen and (min-width:992px) {
#mainNav .navbar-brand { #mainNav .navbar-brand {
padding: 10px 20px; padding: 10px 20px;
color: #fff color: #fff;
} }
#mainNav .navbar-brand:focus, #mainNav .navbar-brand:focus,
#mainNav .navbar-brand:hover { #mainNav .navbar-brand:hover {
color: rgba(255, 255, 255, .8) color: rgba(255, 255, 255, .8);
} }
} }
.wrapper { .wrapper {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100vh height: 100vh;
} }
#maincontent { #maincontent {
flex: 1 0 auto flex: 1 0 auto;
} }
footer { footer {
@ -113,20 +113,20 @@ footer {
left: 0; left: 0;
padding: 20px 0 20px; padding: 20px 0 20px;
background-color: #232323; background-color: #232323;
color: #fff color: #fff;
} }
.copyright { .copyright {
font-size: 14px; font-size: 14px;
margin-bottom: 0; margin-bottom: 0;
text-align: center text-align: center;
} }
.btn { .btn {
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
} }
.btn-lg { .btn-lg {
font-size: 16px; font-size: 16px;
padding: 25px 35px padding: 25px 35px;
} }

BIN
src/docs/favicon-small.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@ -26,7 +26,7 @@
<nav class="navbar navbar-expand-lg navbar-light fixed-top" id="mainNav"> <nav class="navbar navbar-expand-lg navbar-light fixed-top" id="mainNav">
<div class="container"> <div class="container">
<a class="navbar-brand" href="index.html"> <a class="navbar-brand" href="index.html">
<img src="favicon.png" width="30" height="30" class="d-inline-block align-top" alt="logo">&nbsp;Human2Regex <img src="favicon-small.png" width="30" height="30" class="d-inline-block align-top" alt="logo">&nbsp;Human2Regex
</a> </a>
</div> </div>
</nav> </nav>

View File

@ -87,7 +87,7 @@ create an optional group
<p><code class="cm-s-idea">repeat 0 or more</code> repeats the intended text 0 or more times (default)</p> <p><code class="cm-s-idea">repeat 0 or more</code> repeats the intended text 0 or more times (default)</p>
<p><code class="cm-s-idea">optionally repeat between 3 to 5</code> optionally repeats the indented text 3 to 5 times</p> <p><code class="cm-s-idea">optionally repeat between 3 to 5</code> optionally repeats the indented text 3 to 5 times</p>
<p class="font-weight-bold">Grouping</p> <p class="font-weight-bold">Grouping</p>
<p><code class="cm-s-idea">create a group called "mygroup"</code> creates a group called "mygroup"</p> <p><code class="cm-s-idea">create a group called mygroup</code> creates a group called "mygroup"</p>
<p><code class="cm-s-idea">create an optional group</code> creates an unnamed optional group</p> <p><code class="cm-s-idea">create an optional group</code> creates an unnamed optional group</p>
</div> </div>
</div> </div>

View File

@ -9,53 +9,51 @@ h4 {
} }
.cheatsheet { .cheatsheet {
height:100%; height: 100%;
padding:10px; padding: 10px;
border-color: #ced4da; border-color: #ced4da;
border-style: solid; border-style: solid;
border-radius: 10px; border-radius: 10px;
border-width: 1px; border-width: 1px
} }
p { p {
font-size: 16px !important; font-size: 16px!important;
} }
.cheatsheet p { .cheatsheet p {
line-height: 1 !important; line-height: 1!important;
} }
.zero-margin-bottom { .zero-margin-bottom {
margin-bottom: 0px; margin-bottom: 0;
} }
#maincontent { #maincontent {
margin-top: 75px; margin-top: 75px;
} }
.align_header {
text-align: center;
margin-bottom: 20px;
}
/* Content skipping */ /* Content skipping */
.skip-top { .skip-top {
top: 10px; top: 10px;
margin: 10px 40% !important; margin: 10px 40%!important
} }
.skip { .skip {
background: #335075 !important; background: #335075!important;
color: #fff !important; color: #fff!important;
position: absolute !important; position: absolute!important;
clip: rect(1px, 1px, 1px, 1px); clip: rect(1px, 1px, 1px, 1px);
float: left; float: left;
margin-left: 20%; margin-left: 20%;
} }
.skip:active, .skip:active,
.skip:focus { .skip:focus {
font-weight: 700; font-weight: 700;
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6); box-shadow: 0 0 2px 2px rgba(0, 0, 0, .6);
clip: auto !important; clip: auto!important;
display: block; display: block;
text-decoration: underline; text-decoration: underline;
padding: 5px; padding: 5px;
@ -66,27 +64,22 @@ p {
z-index: 10000; z-index: 10000;
} }
.mid-margin {
margin-left: 20px;
margin-right: 20px;
}
/* accessibility */ /* accessibility */
a:hover { a:hover {
color: #208bff; color: #208bff;
} }
.navbar-light .navbar-nav .nav-link { .navbar-light .navbar-nav .nav-link {
color: rgba(0, 0, 0, 0.54); color: rgba(0, 0, 0, .54);
} }
.navbar { .navbar {
padding: 0 !important; padding: 0!important;
} }
#errors { #errors {
resize: none; resize: none;
background-color: #FFF; background-color: #fff;
} }
.CodeMirror { .CodeMirror {
@ -125,38 +118,47 @@ a:hover {
} }
code { code {
font-style: italic!important; font-style: italic!important
} }
.tutorial-code { .tutorial-code {
display: block; display: block;
margin: 20px; padding-left: 20px;
margin-top: 10px;
margin-bottom: 10px;
font-size: 16px!important;
white-space: pre;
background-color: rgb(0 0 0 / .05);
} }
@media (min-width: 576px) { @media (min-width:576px) {
.contained-container { .contained-container {
max-width:540px max-width: 540px;
} }
} }
@media (min-width: 768px) { @media (min-width:768px) {
.contained-container { .contained-container {
max-width:720px max-width: 720px;
} }
} }
@media (min-width: 992px) { @media (min-width:992px) {
.contained-container { .contained-container {
max-width:960px max-width: 960px;
} }
} }
@media (min-width: 1200px) { @media (min-width:1200px) {
.contained-container { .contained-container {
max-width:1140px max-width: 1140px;
} }
} }
td { td {
font-size: 16px; font-size: 16px;
} }
pre code {
font-size: 87.5%;
}

View File

@ -7,40 +7,39 @@
<h2>Tutorial</h2> <h2>Tutorial</h2>
<br> <br>
<p class="font-weight-bold">Preface</p> <p class="font-weight-bold" id="tut-preface">0. Preface</p>
<p>Human2Regex (H2R) is a way to spell out a regular expression in an easy to read, easy to modify language. H2R supports multiple languages as well as many (though not all) different regular expression options such as named groups and quantifiers. You may notice multiple keywords specifying the same thing, and that is intended! H2R is made to be flexible and easy to understand. With a range, do you prefer "...", "through", or "to"? It's up to you to choose, H2R supports all of those!</p> <p>Human2Regex (H2R) is a way to spell out a regular expression in an easy to read, easy to modify language. H2R supports multiple languages as well as many (though not all) different regular expression options such as named groups and quantifiers. You may notice multiple keywords specifying the same thing, and that is intended! Just like how in English there are many ways to express yourself, H2R is made to be flexible and easy to understand. With a range, do you prefer "...", "through", or "to"? It's up to you to choose, H2R supports all of those!</p>
<p class="font-weight-bold">Your first Match</p> <br>
<p>Every language starts with a "Hello World" program, so let's match the output of those programs. Matching is done using the keyword "match" followed by what you want to match. <p class="font-weight-bold" id="tut-first-match">1. Your first Match</p>
<p>Every language starts with a "Hello World" program, so let's match the output of those programs. Matching is done using the keyword <code class="cm-s-idea">match</code> followed by what you want to match.
<span class="tutorial-code"><code class="cm-s-idea"> <span class="tutorial-code"><code class="cm-s-idea">
match "Hello World" match "Hello World"
</code></span> </code></span>
The above statement will generate a regular expression that matches "Hello World". Any invalid characters will automatically be escaped, so you don't need to worry about it. The above statement will generate a regular expression that matches "Hello World", like "/Hello World/". Any invalid characters will automatically be escaped, so you don't need to worry about it. H2R also supports block comments with <code class="cm-s-idea">/**/</code>, or line comments with <code class="cm-s-idea">//</code> or <code class="cm-s-idea">#</code> so you can explain why or what you intend to match.</p>
H2R also supports block comments with <code class="cm-s-idea">/**/</code>, or line comments with <code class="cm-s-idea">//</code> or <code class="cm-s-idea">#</code> so you can explain why or what you intend to match. <pre class="tutorial-code"><code class="cm-s-idea">/* This is a block comment */
<span class="tutorial-code"><code class="cm-s-idea">
match "Hello World" // matches the output of "Hello World" programs match "Hello World" // matches the output of "Hello World" programs
</code></span> </code></pre>
Now what if we want to match every case variation of "Hello World" like "hello world" or "hELLO wORLD"? H2R supports the <code class="cm-s-idea">or</code> operator which allows you to specify many possible combinations. <p>Now what if we want to match every case variation of "Hello World" like "hello world" or "hELLO wORLD"? H2R supports the <code class="cm-s-idea">or</code> operator which allows you to specify many possible combinations.
<span class="tutorial-code"><code class="cm-s-idea"> <span class="tutorial-code"><code class="cm-s-idea">
match "Hello World" or "hello world" or "hELLO wORLD" match "Hello World" or "hello world" or "hELLO wORLD"
</code></span> </code></span>
Or, you can use a <code class="cm-s-idea">using</code> statement to specify that you want it to be case insensitive.</p> Or, you can use a <code class="cm-s-idea">using</code> statement to specify that you want it to be case insensitive.</p>
<p class="font-weight-bold">Using Specifiers</p> <br>
<p class="font-weight-bold" id="tut-using">2. Using Specifiers</p>
<p>Using statements appear at the beginning. You may have one or more using statements which each can contain one or more specifiers. For example: <p>Using statements appear at the beginning. You may have one or more using statements which each can contain one or more specifiers. For example:
<span class="tutorial-code"><code class="cm-s-idea"> <span class="tutorial-code"><code class="cm-s-idea">
using global and case insensitive matching using global and case insensitive matching
</code></span> </code></span>
or or</p>
<span class="tutorial-code"><code class="cm-s-idea"> <pre class="tutorial-code">
using global <code class="cm-s-idea">using global
</code></span>
<span class="tutorial-code"><code class="cm-s-idea">
using case insensitive using case insensitive
</code></span> </code></pre>
The <code class="cm-s-idea">matching</code> keyword is optional. The flags which are available are:</p> <p>The <code class="cm-s-idea">matching</code> keyword is optional. The flags which are available are:</p>
<table class="table table-striped table-bordered"> <table class="table table-sm table-striped table-bordered">
<thead> <thead>
<tr> <tr>
<th scope="col">Specifier</th> <th scope="col">Specifier</th>
@ -77,26 +76,20 @@ using case insensitive
</tbody> </tbody>
</table> </table>
<p>To match any variation of hello world, we would then do the following: <p>To match any variation of hello world, we would then do the following:</p>
<span class="tutorial-code"><code class="cm-s-idea"> <pre class="tutorial-code"><code class="cm-s-idea">using case insensitive matching
using case insensitive matching
</code></span>
<span class="tutorial-code"><code class="cm-s-idea">
match "hello world" match "hello world"
</code></span></p> </code></pre>
<p class="font-weight-bold">Matching multiple items</p> <br>
<p>H2R comes with 2 options to match multiple items in a row. The first is to simply write multiple seperate <code class="cm-s-idea">match</code> statements like: <p class="font-weight-bold" id="tut-multiple-match">3. Matching multiple items</p>
<span class="tutorial-code"><code class="cm-s-idea"> <p>H2R comes with 2 options to match multiple items in a row. The first is to simply write multiple seperate <code class="cm-s-idea">match</code> statements like:</p>
match "hello" <pre class="tutorial-code">
</code></span> <code class="cm-s-idea">match "hello"
<span class="tutorial-code"><code class="cm-s-idea">
match " " match " "
</code></span>
<span class="tutorial-code"><code class="cm-s-idea">
match "world" match "world"
</code></span> </code></pre>
However, you can also use a comma, <code class="cm-s-idea">and</code>, or <code class="cm-s-idea">then</code> for a more concise match. <p>However, you can also use a comma, <code class="cm-s-idea">and</code>, or <code class="cm-s-idea">then</code> for a more concise match.
<span class="tutorial-code"><code class="cm-s-idea"> <span class="tutorial-code"><code class="cm-s-idea">
match "hello", " ", "world" match "hello", " ", "world"
</code></span> </code></span>
@ -113,12 +106,13 @@ match "hello" then " " then "world"
match "hello", " " and then "world" match "hello", " " and then "world"
</code></span> </code></span>
<p class="font-weight-bold">Optionality</p> <br>
<p class="font-weight-bold" id="tut-optionality">4. Optionality</p>
<p>Sometimes you wish to match something that may or may not exist. In H2R, this is done via the <code class="cm-s-idea">optional</code> or <code class="cm-s-idea">optionally</code> keyword. <p>Sometimes you wish to match something that may or may not exist. In H2R, this is done via the <code class="cm-s-idea">optional</code> or <code class="cm-s-idea">optionally</code> keyword.
<span class="tutorial-code"><code class="cm-s-idea"> <span class="tutorial-code"><code class="cm-s-idea">
optionally match "hello world" optionally match "hello world"
</code></span> </code></span>
will match 0 or 1 "hello world"'s. This can be used along side matching multiple statements in a single <code class="cm-s-idea">match</code> statement. will match 0 or 1 "hello world"'s. This can be used alongside matching multiple statements in a single <code class="cm-s-idea">match</code> statement.
<span class="tutorial-code"><code class="cm-s-idea"> <span class="tutorial-code"><code class="cm-s-idea">
match "hello", optionally " ", "world" match "hello", optionally " ", "world"
</code></span> </code></span>
@ -128,20 +122,22 @@ optionally match "hello", " ", then "world"
</code></span> </code></span>
will actually make the whole "hello world" an optional match rather than just the first "hello". If you want to make the first match optional but keep the rest required, use multiple <code class="cm-s-idea">match</code> statements.</p> will actually make the whole "hello world" an optional match rather than just the first "hello". If you want to make the first match optional but keep the rest required, use multiple <code class="cm-s-idea">match</code> statements.</p>
<p class="font-weight-bold">Negation</p> <br>
<p class="font-weight-bold" id="tut-negation">5. Negation</p>
<p>You can negate a match with the operator <code class="cm-s-idea">not</code> <p>You can negate a match with the operator <code class="cm-s-idea">not</code>
<span class="tutorial-code"><code class="cm-s-idea"> <span class="tutorial-code"><code class="cm-s-idea">
match not "hello world" match not "hello world"
</code></span> </code></span>
will match everything except for "hello world".</p> will match everything except for "hello world".</p>
<p class="font-weight-bold">Other matching specifiers</p> <br>
<p class="font-weight-bold" id="tut-other-match">6. Other matching specifiers</p>
<p>Many times you don't know exactly what you wish to match. H2R comes with many specifiers that you can use for your matching. For example, you may wish to match any word. You can do that with: <p>Many times you don't know exactly what you wish to match. H2R comes with many specifiers that you can use for your matching. For example, you may wish to match any word. You can do that with:
<span class="tutorial-code"><code class="cm-s-idea"> <span class="tutorial-code"><code class="cm-s-idea">
match a word match a word
</code></span> </code></span>
The <code class="cm-s-idea">a</code> or <code class="cm-s-idea">an</code> is optional. The possible specifiers that H2R supports are the following:</p> The <code class="cm-s-idea">a</code> or <code class="cm-s-idea">an</code> is optional. The possible specifiers that H2R supports are the following:</p>
<table class="table table-striped table-bordered"> <table class="table table-sm table-striped table-bordered">
<thead> <thead>
<tr> <tr>
<th scope="col">Specifier</th> <th scope="col">Specifier</th>
@ -205,15 +201,15 @@ match a word
<p>You can also create ranges of characters to match. Say for example, you wanted to match any characters between a and z, you could write any of the following: <p>You can also create ranges of characters to match. Say for example, you wanted to match any characters between a and z, you could write any of the following:
<span class="tutorial-code"><code class="cm-s-idea"> <span class="tutorial-code"><code class="cm-s-idea">
match from "a" to "z" // from is optional match from "a" to "z" // "from" is optional
</code></span> </code></span>
or or
<span class="tutorial-code"><code class="cm-s-idea"> <span class="tutorial-code"><code class="cm-s-idea">
match between "a" and "z" // between is optional match between "a" and "z" // "between" is optional
</code></span> </code></span>
or or
<span class="tutorial-code"><code class="cm-s-idea"> <span class="tutorial-code"><code class="cm-s-idea">
match "a" ... "z" // can use ... or .. match "a" ... "z" // can use "..." or ".."
</code></span> </code></span>
or or
<span class="tutorial-code"><code class="cm-s-idea"> <span class="tutorial-code"><code class="cm-s-idea">
@ -224,65 +220,100 @@ match "a" - "z"
match "a" through "z" // can also use thru match "a" through "z" // can also use thru
</code></span> </code></span>
<p class="font-weight-bold">Repetition</p> <br>
<!--<p>H2R supports 2 types of repetition: single match repetition, or grouped repetition. When using "match" you can specify the number of captures you want just before the text you want to capture. Example: <code class="cm-s-idea">match 2 digits</code> will match any 2 characters in a row. You can also specify a range you wish to capture. Example: <code class="cm-s-idea">match 2..5 digits</code> will match 2, 3, 4, or 5 digits. You can specify if the final number is exclusive with the "exclusive" keyword. Example: <code class="cm-s-idea">match 2 to 5 exclusive digits</code> will only match up to 4 digits. You can group a repetition using the "repeat" keyword. By default, this will match 0 or more of the following statements. The same qualifiers that exist for match exist for repeat. Example: <code class="cm-s-idea">optionally repeat 3...7 times</code></p> <p class="font-weight-bold" id="tut-repeition">7. Repetition</p>
<p>H2R supports 2 types of repetition: single match repetition, or grouped repetition. When using <code class="cm-s-idea">match</code> you can specify the number of captures you want just before the text to capture.
<span class="tutorial-code"><code class="cm-s-idea">
match 2 digits
</code></span>
or
<span class="tutorial-code"><code class="cm-s-idea">
match exactly 2 digits
</code></span>
will match any 2 digits in a row. You can also specify a range you wish to capture
<span class="tutorial-code"><code class="cm-s-idea">
match 2 ... 5 digits
</code></span>
or
<span class="tutorial-code"><code class="cm-s-idea">
match 2 to 5 digits
</code></span>
or
<span class="tutorial-code"><code class="cm-s-idea">
match between 2 to 5 digits
</code></span>
will match 2, 3, 4, or 5 digits. You can specify if the final number is exclusive with the <code class="cm-s-idea">exclusive</code> or <code class="cm-s-idea">inclusive</code> keywords.
<span class="tutorial-code"><code class="cm-s-idea">
match 2 to 5 exclusive digits
</code></span>
will only match up to 4 digits. You can also choose to leave the end unspecified.
<span class="tutorial-code"><code class="cm-s-idea">
match 2+ digits
</code></span>
or
<span class="tutorial-code"><code class="cm-s-idea">
match 2 or more digits
</code></span>
will match 2 or more digits. Repeition can be chained with the <code class="cm-s-idea">and then</code> keywords or the <code class="cm-s-idea">optional</code> keyword. For example:
<span class="tutorial-code"><code class="cm-s-idea">
match 1+ digits then optionally "." then optionally 0...8 digits
</code></span>
<p>Optional repeat</p>--> Suppose you want to repeat a group of these match statements. You can group a repetition using the <code class="cm-s-idea">repeat</code> keyword. Everything underneath that is tabbed (scoped) will be repeated. By default, this will match 0 or more of the following statements.</p>
<p>TODO</p> <pre class="tutorial-code">
<code class="cm-s-idea">repeat
match "Hello "
match "World"
</code></pre>
<p>Will match 0 or more "Hello "s, but only 1 "World". The same qualifiers that exist for <code class="cm-s-idea">match</code> statements also exist for <code class="cm-s-idea">repeat</code> statements.</p>
<pre class="tutorial-code">
<code class="cm-s-idea">optionally repeat 3...7 times
match "Hello World"
</code></pre>
<p>Will potentially match "Hello World" between 3 and 7 times. H2R also supports the following for numbers: <code class="cm-s-idea">One, Two, Three, Four, Five, Six, Seven, Eight, Nine, and Ten</code></p>
<table class="table table-striped table-bordered"> <br>
<thead> <p class="font-weight-bold" id="tut-grouping">8. Grouping</p>
<tr> <p>Just like regular expressions, capture and non-capture groups are supported in H2R. Each group is defined using the <code class="cm-s-idea">create a group</code> keyphrase.</p>
<th scope="col">String value</th> <pre class="tutorial-code">
<th scope="col">Numeric value</th> <code class="cm-s-idea">create a group
</tr> match "Hello World"
</thead> </code></pre>
<tbody> <p>This will create a non-captured group, equivalent to the regular expression "/(?:Hello World)/". A non-captured group will not show up in your chosen language's matches. If you do wish to capture a group, simply give it a name:<p>
<tr> <pre class="tutorial-code">
<td>Zero</td><td>0</td> <code class="cm-s-idea">create a group called TestGroup
</tr> match "Hello World"
<tr> </code></pre>
<td>One</td><td>1</td> <p>In most languages, a named group can be accessed through the match result's group list. Take for example, in JavaScript,
</tr> <pre class="tutorial-code">
<tr> <code class="cm-s-idea">"hello".match(/(?&lt;TestGroup&gt;hello)/).groups</code>
<td>Two</td><td>2</td> </pre>
</tr>
<tr>
<td>Three</td><td>3</td>
</tr>
<tr>
<td>Four</td><td>4</td>
</tr>
<tr>
<td>Five</td><td>5</td>
</tr>
<tr>
<td>Six</td><td>6</td>
</tr>
<tr>
<td>Seven</td><td>7</td>
</tr>
<tr>
<td>Eight</td><td>8</td>
</tr>
<tr>
<td>Nine</td><td>9</td>
</tr>
<tr>
<td>Ten</td><td>10</td>
</tr>
</tbody>
</table>
<p class="font-weight-bold">Grouping</p> <p>Will return an object with {TestGroup: "hello"}. For another example, check out <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match#Using_named_capturing_groups">MDN web docs</a>. Groups can also be optional.</p>
<p>TODO</p> <pre class="tutorial-code">
<!-- Optional, create a group <code class="cm-s-idea">create an optional group
create a group called match "Hello World"
--> </code></pre>
<p>And groups may be nested</p>
<pre class="tutorial-code">
<code class="cm-s-idea">create a group called TestGroup
match "Hello"
create a group called InnerGroup
match "World"
</code></pre>
<p>The regular expression returned by this will be "/(?&lt;TestGroup&gt;Hello(?&lt;InnerGroup&gt;World))/". Again, in JavaScript, the following</p>
<pre class="tutorial-code">
<code class="cm-s-idea">"HelloWorld".match(/(?&lt;TestGroup&gt;Hello(?&lt;InnerGroup&gt;World))/).groups</code>
</pre>
<p>Will return an object with {TestGroup: "HelloWorld", InnerGroup: "World"}.</p>
<br>
<h3 id="tut-final">Putting it all together</h3>
<p>Grouping, repetition, and matching are the 3 primary elements that make up H2R. They can be combined in any way to generate a regular expression. See the <a href="index.html">main page</a> for an example that combines all above to parse a URL.</p>
<h3>Miscellaneous features</h3> <h3>Miscellaneous features</h3>
<p class="font-weight-bold">Unicode character properties</p> <p class="font-weight-bold" id="tut-unicode">Unicode character properties</p>
<p>You can match specific unicode sequences using <code class="cm-s-idea">"\uXXXX" <p>You can match specific unicode sequences using <code class="cm-s-idea">"\uXXXX"
</code> or <code class="cm-s-idea">"\UXXXXXXXX"</code> where X is a hexadecimal character. </code> or <code class="cm-s-idea">"\UXXXXXXXX"</code> where X is a hexadecimal character.
<span class="tutorial-code"><code class="cm-s-idea"> <span class="tutorial-code"><code class="cm-s-idea">
@ -296,86 +327,62 @@ match unicode "Latin" // matches any latin character
match unicode "N" // matches any number character match unicode "N" // matches any number character
</code></span> </code></span>
The following Unicode class specifiers are available:</p> The following Unicode class specifiers are available:</p>
<table class="table table-striped table-bordered"> <table class="table table-sm table-striped table-bordered">
<thead> <thead>
<tr> <tr>
<th scope="col">Class</th> <th scope="col">Class</th>
<th scope="col">Description</th> <th scope="col">Description</th>
<th scope="col">Class</th>
<th scope="col">Description</th>
<th scope="col">Class</th>
<th scope="col">Description</th>
<th scope="col">Class</th>
<th scope="col">Description</th>
<th scope="col">Class</th>
<th scope="col">Description</th>
<th scope="col">Class</th>
<th scope="col">Description</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr><td>C</td><td>Other</td></tr>
<td>C</td><td>Other</td> <tr><td>Cc</td><td>Control</td></tr>
<td>Cc</td><td>Control</td> <tr><td>Cf</td><td>Format</td></tr>
<td>Cf</td><td>Format</td> <tr><td>Cn</td><td>Unassigned</td></tr>
<td>Cn</td><td>Unassigned</td> <tr><td>Co</td><td>Private use</td></tr>
<td>Co</td><td>Private use</td> <tr><td>Cs</td><td>Surrogate</td></tr>
<td>Cs</td><td>Surrogate</td>
</tr> <tr><td>L</td><td>Letter</td></tr>
<tr> <tr><td>Ll</td><td>Lower case letter</td></tr>
<td>L</td><td>Letter</td> <tr><td>Lm</td><td>Modifier letter</td></tr>
<td>Ll</td><td>Lower case letter</td> <tr><td>Lo</td><td>Other letter</td></tr>
<td>Lm</td><td>Modifier letter</td> <tr><td>Lt</td><td>Title case letter</td></tr>
<td>Lo</td><td>Other letter</td> <tr><td>Lu</td><td>Upper case letter</td></tr>
<td>Lt</td><td>Title case letter</td>
<td>Lu</td><td>Upper case letter</td> <tr><td>M</td><td>Mark</td></tr>
</tr> <tr><td>Mc</td><td>Spacing mark</td></tr>
<tr> <tr><td>Me</td><td>Enclosing mark</td></tr>
<td>M</td><td>Mark</td> <tr><td>Mn</td><td>Non-spacing mark</td></tr>
<td>Mc</td><td>Spacing mark</td> <tr><td>N</td><td>Number</td></tr>
<td>Me</td><td>Enclosing mark</td> <tr><td>Nd</td><td>Decimal number</td></tr>
<td>Mn</td><td>Non-spacing mark</td>
<td>N</td><td>Number</td> <tr><td>Nl</td><td>Letter number</td></tr>
<td>Nd</td><td>Decimal number</td> <tr><td>No</td><td>Other number</td></tr>
</tr> <tr><td>P</td><td>Punctuation</td></tr>
<tr> <tr><td>Pc</td><td>Connector punctuation</td></tr>
<td>Nl</td><td>Letter number</td> <tr><td>Pd</td><td>Dash punctuation</td></tr>
<td>No</td><td>Other number</td> <tr><td>Pe</td><td>Close punctuation</td></tr>
<td>P</td><td>Punctuation</td>
<td>Pc</td><td>Connector punctuation</td> <tr><td>Pf</td><td>Final punctuation</td></tr>
<td>Pd</td><td>Dash punctuation</td> <tr><td>Pi</td><td>Initial punctuation</td></tr>
<td>Pe</td><td>Close punctuation</td> <tr><td>Po</td><td>Other punctuation</td></tr>
</tr> <tr><td>Ps</td><td>Open punctuation</td></tr>
<tr> <tr><td>S</td><td>Symbol</td></tr>
<td>Pf</td><td>Final punctuation</td> <tr><td>Sc</td><td>Currency symbol</td></tr>
<td>Pi</td><td>Initial punctuation</td>
<td>Po</td><td>Other punctuation</td> <tr><td>Sk</td><td>Modifier symbol</td></tr>
<td>Ps</td><td>Open punctuation</td> <tr><td>Sm</td><td>Mathematical symbol</td></tr>
<td>S</td><td>Symbol</td> <tr><td>So</td><td>Other symbol</td></tr>
<td>Sc</td><td>Currency symbol</td> <tr><td>Z</td><td>Separator</td></tr>
</tr> <tr><td>Zl</td><td>Line separator</td></tr>
<tr> <tr><td>Zp</td><td>Paragraph separator</td></tr>
<td>Sk</td><td>Modifier symbol</td> <tr><td>Zs</td><td>Space separator</td></tr>
<td>Sm</td><td>Mathematical symbol</td>
<td>So</td><td>Other symbol</td>
<td>Z</td><td>Separator</td>
<td>Zl</td><td>Line separator</td>
<td>Zp</td><td>Paragraph separator</td>
</tr>
<tr>
<td>Zs</td><td>Space separator</td>
<td>&nbsp;</td><td>&nbsp;</td>
<td>&nbsp;</td><td>&nbsp;</td>
<td>&nbsp;</td><td>&nbsp;</td>
<td>&nbsp;</td><td>&nbsp;</td>
<td>&nbsp;</td><td>&nbsp;</td>
</tr>
</tbody> </tbody>
</table> </table>
<p>The following Unicode script specifiers are available:</p> <p>The following Unicode script specifiers are available:</p>
<p>Note: Java and .NET require "Is" in front of the script name. For example, "IsLatin" rather than just "Latin"</p> <p>Note: Java and .NET require "Is" in front of the script name. For example, "IsLatin" rather than just "Latin"</p>
<table class="table table-striped table-bordered"> <table class="table table-sm table-striped table-bordered">
<tbody> <tbody>
<tr> <tr>
<td>Arabic</td> <td>Arabic</td>

View File

@ -131,7 +131,21 @@ export class Human2RegexParser extends EmbeddedActionsParser {
{ ALT: () => { { ALT: () => {
$.CONSUME(T.To); $.CONSUME(T.To);
const val = $.SUBRULE3(NumberSubStatement); const val = $.SUBRULE3(NumberSubStatement);
return new TokenAndValue(val.token, [ val.value, null ]);
const opt = $.OPTION7(() => {
return $.OR5([
{ ALT: () => {
tokens.push($.CONSUME2(T.Inclusive));
return "inclusive";
}},
{ ALT: () => {
tokens.push($.CONSUME2(T.Exclusive));
return "exclusive";
}}
]);
});
return new TokenAndValue(val.token, [ val.value, opt ]);
}} }}
]); ]);
tokens.push(to.token); tokens.push(to.token);

View File

@ -79,7 +79,7 @@ document.addEventListener("DOMContentLoaded", function() {
{token: "keyword", regex: /inclusive(ly)?/i}, {token: "keyword", regex: /inclusive(ly)?/i},
{token: "keyword", regex: /exclusive(ly)?/i}, {token: "keyword", regex: /exclusive(ly)?/i},
{token: "keyword", regex: /from/i}, {token: "keyword", regex: /from/i},
{token: "keyword", regex: /(to|through|thru|\-|\.\.\.|\.\.)/i}, {token: "keyword", regex: /(to|through|thru|\-|\.\.\.?)/i},
{token: "keyword", regex: /create(s)?/i}, {token: "keyword", regex: /create(s)?/i},
{token: "keyword", regex: /name(d)?|call(ed)?/i}, {token: "keyword", regex: /name(d)?|call(ed)?/i},
{token: "keyword", regex: /repeat(s|ing)?/i}, {token: "keyword", regex: /repeat(s|ing)?/i},

View File

@ -48,7 +48,7 @@ import { createToken, Lexer } from "chevrotain";
/** @internal */ export const Inclusive = createToken({name: "Inclusive", pattern: /inclusive(ly)?/i}); /** @internal */ export const Inclusive = createToken({name: "Inclusive", pattern: /inclusive(ly)?/i});
/** @internal */ export const Exclusive = createToken({name: "Exclusive", pattern: /exclusive(ly)?/i}); /** @internal */ export const Exclusive = createToken({name: "Exclusive", pattern: /exclusive(ly)?/i});
/** @internal */ export const From = createToken({name: "From", pattern: /from/i}); /** @internal */ export const From = createToken({name: "From", pattern: /from/i});
/** @internal */ export const To = createToken({name: "To", pattern: /(to|through|thru|\-|\.\.|\.\.\.)/i}); /** @internal */ export const To = createToken({name: "To", pattern: /(to|through|thru|\-|\.\.\.?)/i});
/** @internal */ export const Create = createToken({name: "Create", pattern: /create(s)?/i}); /** @internal */ export const Create = createToken({name: "Create", pattern: /create(s)?/i});
/** @internal */ export const Called = createToken({name: "Called", pattern: /name(d)?|call(ed)?/i}); /** @internal */ export const Called = createToken({name: "Called", pattern: /name(d)?|call(ed)?/i});
/** @internal */ export const Repeat = createToken({name: "Repeat", pattern: /repeat(s|ing)?/i}); /** @internal */ export const Repeat = createToken({name: "Repeat", pattern: /repeat(s|ing)?/i});