Skip to content

Regex fix example added #676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/parser-opts/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { gitmojiCodeRegex, gitmojiUnicodeRegex, emojiRegex } from '@gitmoji/gitmoji-regex';
import { emojiRegex, gitmojiCodeRegex, gitmojiUnicodeRegex } from '@gitmoji/gitmoji-regex';

const gitmojiCodeStr = gitmojiCodeRegex.source;
const gitmojiUnicodeStr = gitmojiUnicodeRegex.source;
const emojiStr = emojiRegex.source;

export default {
// Test URL: https://regex101.com/r/gYkG99/1
// Test URL: https://regex101.com/r/HYr6d3/1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add some more test examples to show the difference between before and after.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added these two lines at the bottom:

:green_heart: fix-ci(ci/cd): added release rules for all cz-emojis

:green_heart: ci/cd(config): changed config for cz-emojis

Here is the new URL: https://regex101.com/r/WXbn1P/1

Not sure I can show a before match in the same link.
Let me know if this is enough.
Cheers!

headerPattern: new RegExp(
`^(?:${gitmojiCodeStr}|(?:${gitmojiUnicodeStr})|(?:${emojiStr}))\\s(?<type>\\w*)(?:\\((?<scope>.*)\\))?!?:\\s(?<subject>(?:(?!#).)*(?:(?!\\s).))(?:\\s\\(?(?<ticket>#\\d*)\\)?)?$`,
`^(?:${gitmojiCodeStr}|(?:${gitmojiUnicodeStr})|(?:${emojiStr}))\\s(?<type>[a-zA-Z-,\/]+)(?:\\((?<scope>.*)\\))?!?:\\s(?<subject>(?:(?!#).)*(?:(?!\\s).))(?:\\s\\(?(?<ticket>#\\d*)\\)?)?$`,
),

headerCorrespondence: ['type', 'scope', 'subject', 'ticket'],
Expand Down