https://github.com/banjo/regcode
🔷 Create regular expressions easily with code
https://github.com/banjo/regcode
regcode regex regular-expression regular-expressions
Last synced: 5 months ago
JSON representation
🔷 Create regular expressions easily with code
- Host: GitHub
- URL: https://github.com/banjo/regcode
- Owner: banjo
- Created: 2021-05-24T08:45:25.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2022-05-31T13:01:30.000Z (about 4 years ago)
- Last Synced: 2025-06-30T07:03:53.895Z (12 months ago)
- Topics: regcode, regex, regular-expression, regular-expressions
- Language: TypeScript
- Homepage: https://regcode.netlify.app/
- Size: 1.59 MB
- Stars: 19
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Create regular expressions easily with code
Docs •
Demo •
Features •
Examples •
API •
License
---

## :heavy_check_mark: Features
* Create Regular Expressions with code
* English-like syntax that is easy to read
* Easy to learn, easy to read
* Simple API
* Convert to Regex or match directly to a string
* Get started in minutes
* No need to learn Regex to create an expression
## :clipboard: Examples
These are some basic examples, there are many more examples over at our [docs](https://regcode-docs.netlify.app) page. You can also try it interactively [here](https://www.regcode.netlify.app).
```ts
// use values
const code = "[character]"
const regex = "/[A-Za-z\u00C0-\u017F]/"
// use logic
const code = "[character]{oneOrMore}[or][number]"
const regex = "/(?:[A-Za-z\u00C0-\u017F]+|\d)/"
// use methods
const code = "normal(H[or]hello) [whitespace] [character]{oneOrMore}"
const regex = "/(?:H|h)ello\s[A-Za-z\u00C0-\u017F]+/"
```
## :cloud: API Example
Install Regcode with NPM or Yarn.
```bash
# npm
npm install regcode --save
# yarn
yarn add regcode
```
Simply create the class and begin using it.
```ts
import { RegCode } from "regcode";
const regCode = new RegCode();
const code = "hasBefore(https://) normal(www.) [character]{any} normal(.com)[or]normal(.net)";
const sentenceToMatch = "The URL is https://www.regcodejs.com, here you go!";
// look for matches
const match = regCode.match(code, sentenceToMatch); // ["www.regcodejs.com"]
// or convert to regex and match the normal way
const regex = regCode.convert(code);
const match = sentenceToMatch.match(regex); // ["www.regcodejs.com"]
```
## License
MIT