yiisoft / yiisoft/mailer

Improve regexps in `HtmlToTextBodyConverter`

Open
#110 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
44
Forks
13
Avg merge
54m
Merged PRs (30d)
1

Description

$html = preg_replace('~<(style|script)[^>]*>.*?</\1>~is', '', $html);
// ...

// Does it make sense to remove spaces from the end of lines?
$text = preg_replace("~^[ \t]+|[ \t]+$~m", '', trim($text));

Originally posted by @Tigrov in https://github.com/yiisoft/mailer-view/pull/2#discussion_r1794502710

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the HtmlToTextBodyConverter entry point and review the two PHP regular expressions shown in the issue. Clarify the intended handling of style/script blocks and trailing line spaces before identifying the relevant conversion behavior to verify; the work is done when the expected regex behavior is explicit and validated.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.