Skip to content
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

added new process to replace the matches #299

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

MrYuto
Copy link

@MrYuto MrYuto commented Mar 1, 2022

I needed a simple way to clean matches or replace some characters.

Example:
From: http://example.com/some-word-that-matches-wildcard
To: http://google.com/some+word+that+matches+wildcard
Include pattern: http://example.com/*
Redirect to: http://google.com/$1
Find: -
Replace with: +
replace All: true

This will process all the matches ($1, $2, ...) with the same thing and NEED a way to separate them

Copy link
Collaborator

@Gitoffthelawn Gitoffthelawn left a comment

Choose a reason for hiding this comment

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

Looks very useful. I proposed 2 changes.

@@ -479,7 +479,7 @@ a.disabled:hover, button[disabled]:hover {
}

.hidden {
display:none;
display:none !important;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this CSS ruleset really need !important added? Is there a way to avoid adding !important?

Copy link
Author

Choose a reason for hiding this comment

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

.form-grid > div selector has a higher specificity and cause an issue so I thought as a utility class it's ok to add !important
but It can be avoided by adding the same declaration with .replace-process-input.hidden selector.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks. I'm good either way. I think adding the .replace-process-input.hidden selector to the .hidden ruleset is a slightly better option. It's a bit cleaner and will prevent any problems in the future if someone removes !important from .hidden because it's not documented why it's present.

js/redirect.js Outdated

if (incPattern) {
this._rxInclude = new RegExp(incPattern, 'gi');
}
if (excPattern) {
this._rxExclude = new RegExp(excPattern, 'gi');
}
if (replPattern) {
const falgs = this.replaceAll ? 'gi' : 'i';
this._rxReplace = new RegExp(replPattern, falgs);
Copy link
Collaborator

Choose a reason for hiding this comment

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

falgs needs to be replaced with flags

Copy link
Collaborator

@Gitoffthelawn Gitoffthelawn left a comment

Choose a reason for hiding this comment

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

LGTM.

Thank you! I think this is a significant improvement. Well done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants