{"id":24380998,"url":"https://github.com/joshaaronlevy/regexbuddy","last_synced_at":"2026-05-25T10:31:48.363Z","repository":{"id":58818419,"uuid":"533952496","full_name":"JoshAaronLevy/regexbuddy","owner":"JoshAaronLevy","description":"Implement common regex functionality in your code with a simplified syntax","archived":false,"fork":false,"pushed_at":"2023-02-27T09:21:44.000Z","size":5077,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-20T06:41:16.761Z","etag":null,"topics":["case-converter","email-validation","javascript","password-validation","password-validator","regex","regular-expression","string-manipulation","string-matching"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JoshAaronLevy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-07T21:43:34.000Z","updated_at":"2023-04-11T15:53:45.000Z","dependencies_parsed_at":"2025-01-19T08:32:37.380Z","dependency_job_id":"61e04e35-65cf-4a89-99eb-c77a591335e8","html_url":"https://github.com/JoshAaronLevy/regexbuddy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshAaronLevy%2Fregexbuddy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshAaronLevy%2Fregexbuddy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshAaronLevy%2Fregexbuddy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshAaronLevy%2Fregexbuddy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JoshAaronLevy","download_url":"https://codeload.github.com/JoshAaronLevy/regexbuddy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243241111,"owners_count":20259520,"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":["case-converter","email-validation","javascript","password-validation","password-validator","regex","regular-expression","string-manipulation","string-matching"],"created_at":"2025-01-19T08:32:32.728Z","updated_at":"2025-12-25T10:51:12.713Z","avatar_url":"https://github.com/JoshAaronLevy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003eregexbuddy\u003c/h1\u003e\n  \u003cp\u003eImplement common regex functionality in your code with a simplified syntax\u003c/p\u003e\n  \u003ca href=\"https://github.com/joshaaronlevy/regexbuddy/actions\"\u003e\u003cimg src=\"https://github.com/joshaaronlevy/regexbuddy/workflows/CI/badge.svg?branch=main\" alt=\"Build Status\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://coveralls.io/github/joshaaronlevy/regexbuddy\"\u003e\u003cimg src=\"https://img.shields.io/coveralls/github/joshaaronlevy/regexbuddy\" alt=\"Coverage Status\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://packagephobia.now.sh/result?p=regexbuddy\"\u003e\u003cimg src=\"https://badgen.net/packagephobia/install/regexbuddy\" alt=\"Current Version\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/regexbuddy\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/regexbuddy\" alt=\"Install Size\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n---\n\nCurrently, regexbuddy has functions for regex-based email validation, password validation, case conversion, as well as array duplicate functions. The array functions - along with other features - are being added, and a new version is released weekly.\n\n## Features\n\n#### 1. Email Validation\n\n#### 2. Password Validation\n\n#### 3. Case Conversion\n\n#### 4. Array De-Duplication\n\n## Installation\n\n**Install in your project locally:**\n\n```bash\nnpm install regexbuddy\n```\n\n## Implement into your project\n\n\u003e Step 1: Import into your project\n\n**NOTE:** Since regexbuddy has function names that are considered generic (i.e. `password(input).validate()`), it's recommended to import it like this:\n\n```javascript\nimport * as regexBuddy from \"regexbuddy\";\n```\n\n\u003e Step 2: That way, you can use it in your code like this\n\n```javascript\nregexBuddy.password(input).validate();\n```\n\n**COMMENT:** While having generic-sounding function names is a (rightfully) contested topic, doing so makes the syntax feel more natural. And implementing it like the example above makes it easier to find where regexbuddy is used in your code, because the functions are prefixed with `regexBuddy`.\n\n## Available Functions and Methods\n\n### Email Validation\n\nFor email validation, you can simply use:\n\n```javascript\nregexBuddy.email(input).validate();\n```\n\nThis runs a regex function to ensure the input is a valid email address. The return value from the above method is:\n\n```javascript\n{\n  valid: Boolean\n  message: `Error message` || null\n}\n```\n\n#### Email Validation Options\n\nYou can also customize validation criteria with `permitted` and `restricted` values.\n\nFor instance, if you wanted to only allow email addresses with a `@yourcompanyname` email address, you would do the following:\n\n```javascript\nregexBuddy.email(input).validate({ permitted: \"yourcompanyname\" });\n```\n\nYou can do the same with email domains you explicitly do not want to permit, like this:\n\n```javascript\nregexBuddy.email(input).validate({ restricted: \"aol\" });\n```\n\nThe `permitted` and `restricted` values let you pass in either a String or Array. So you can also do this:\n\n```javascript\nregexBuddy.email(input).validate({ restricted: [\"aol\", \"hotmail\"] });\n```\n\n### Password Validation\n\nFor password validation, you can simply use:\n\n```javascript\nregexBuddy.password(input).validate();\n```\n\nThis takes the `input` value you pass in as an argument, and validates against the default password requirements.\n\nDefault requirements are that a password must contain (with the option name and data type for overwriting defaults):\n\n1. At least one uppercase letter (name: requireUpperCase, type: boolean)\n2. At least one lowercase letter (name: requireLowerCase, type: boolean)\n3. At least one number (name: requireNumber, type: boolean)\n4. At least one special character (name: requireSpecialCharacter, type: boolean)\n5. A minimum of 5 characters (name: minLength, type: number)\n\nThe default requirements can be overwritten by passing in your requirements in the validate function like this:\n\n```javascript\nregexBuddy.password(input).validate({ minLength: 8, requireSpecialCharacter: false });\n```\n\n**NOTE:** Options that are ignored will still have their default values used. So in the example above, a password must have at least 8 characters and does not need to have a number. But it must also still include an uppercase letter, lowercase letter, and a special character.\n\n**NOTE:** The password validation method returns an object structured like this:\n\n```javascript\n{\n  valid: Boolean,\n  errors: [ validationErrors ] || null\n}\n```\n\nThis gives you the option of serving the client an array of the criteria not met when creating a password, or simply using the password validation method in a conditional expression. And the `valid` property was added for those who prefer using explicit conditional evaluation over implicit \"truthy\" methods for something like a password.\n\nAn example of how to use this in your code would be:\n\n```javascript\nconst passwordCheck = regexBuddy.password(input).validate({ minlength: 8, requireSpecialCharacter: false });\n```\n\nThis would let you reference the `passwordCheck` variable in a simple way, like these examples:\n\n```javascript\n// If a password is invalid\nif (passwordCheck.errors) {\n  // You can then map the array of errors in passwordCheck.errors to a DOM object, like a toast, modal, etc.\n  ...\n}\n```\n\nOr implement as a simple, explicit conditional in your corresponding template file, like this example, where a submit button is disabled when there are any errors with the user's input value:\n\n```html\n\u003cbutton type=\"submit\" disabled={!passwordCheck.valid}\u003eSubmit\u003c/button\u003e\n```\n\nYou can also ensure strict password matching when requiring someone to re-enter their password with the `matches()` method, like this:\n\n```javascript\nregexBuddy.password(password1).matches(password2);\n```\n\nThis simply returns `true` or `false`.\n\n### Case Conversion\n\nWith regexbuddy, you can convert any string into either pascal, camel, kebab, snake, or sql case. You can do this with the following method:\n\n```javascript\nregexBuddy.convertCase(\"your String goes Here\")\n```\n\nUsing the base syntax returns an object that looks like this:\n\n```javascript\n{\n  original: 'your String goes Here',\n  camel: 'yourStringGoesHere',\n  kebab: 'your-string-goes-here',\n  pascal: 'Your String Goes Here',\n  snake: 'your_string_goes_here',\n  sql: 'YOUR_STRING_GOES_HERE'\n}\n```\n\nIf you need to use different cases for a value throughout your code, you can utilize case conversion like this:\n\n```javascript\nconst dName = regexBuddy.convertCase(displayName)\n```\n\nAnd wherever you use the `dName` variable, you can specifiy the case like this:\n\n```html\n\u003ch2 className=\"card-header\"\u003e{dName.pascal}\u003c/h2\u003e\n```\n\nThe case converter also accepts a designated case as an option. You can do so like this:\n\n```javascript\nregexBuddy.convertCase(\"your String goes Here\", { case: 'camel' })\n```\n\nThe return value of this is simply the string converted into the desired case.\n\n**NOTE:** This is a much more performant way to utilize the case converter, and is recommended, when you can.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshaaronlevy%2Fregexbuddy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshaaronlevy%2Fregexbuddy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshaaronlevy%2Fregexbuddy/lists"}