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

Add Append Version of matchFromBody Replacement Text Function #345

Open
EnigmaSolved opened this issue Jan 3, 2025 · 2 comments
Open

Add Append Version of matchFromBody Replacement Text Function #345

EnigmaSolved opened this issue Jan 3, 2025 · 2 comments
Assignees

Comments

@EnigmaSolved
Copy link

Currently we have %header.set.matchFromBody(hdr,regex,"replacement text")% which allows us to set replacement text on something if we find the regex expression match (which might be different text).

I would like an .append version of that, as in:
%header.append.matchFromBody(hdr,regex,"text to append")%

I mention here a use case for this.

Thanks for considering my request! :)

@RealRaven2000
Copy link
Owner

RealRaven2000 commented Jan 3, 2025

Sounds reasonable.

I will mull it over during the weekend. Basically it just means to extend all header.append functions with the matchFromBody keyword. Apparently it is already a legal token; I don't currently recall if I prepared that for implementing it later or is it already implemented (undocumented) and is only missing the "replaceArgument" parameter? (third param is expected to be matchGroup)

@RealRaven2000
Copy link
Owner

RealRaven2000 commented Jan 4, 2025

The syntax below seems to work for me already:

%header.append.matchFromBody(subject,"Fred Flintstones","Firestones")%

there is also a prefix variant. and also 3 more variations with matchFromSubject since they are fairly ubiquitous:

  "header.set.matchFromSubject", 
  "header.append.matchFromSubject", 
  "header.prefix.matchFromSubject",
  "header.set.matchFromBody", 
  "header.append.matchFromBody", 
  "header.prefix.matchFromBody"

my guess is they all support the replacement / alternative value parameter.

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

No branches or pull requests

2 participants