Skip to content

In a node containing multiple matches of the search string or regex, only the first occurrence is replaced #5

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

Closed
4 tasks done
lpsinger opened this issue Sep 12, 2023 · 3 comments
Labels
🤷 no/invalid This cannot be acted upon 👎 phase/no Post cannot or will not be acted on

Comments

@lpsinger
Copy link
Contributor

Initial checklist

Affected packages and versions

[email protected]

Link to runnable example

#4

Steps to reproduce

See new unit test in PR above. The search string is the regular expression /(emph|sis)/ and the replacement text is 'foo'. So the text node with the content 'emphasis' should be replaced with three new text nodes, with the contents 'foo', 'a', and 'foo', respectively.

Expected behavior

The test should pass.

Actual behavior

The test fails because only the first match is replaced, resulting in only two nodes with the contents 'foo' and 'asis', respectively.

Affected runtime and version

[email protected]

Affected package manager and version

[email protected]

Affected OS and version

macOS Ventura 13.5.2

Build and bundle tools

No response

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Sep 12, 2023
@lpsinger
Copy link
Contributor Author

Oh... right, I didn't set the global /.../g flag.

@lpsinger lpsinger closed this as not planned Won't fix, can't repro, duplicate, stale Sep 12, 2023
@github-actions

This comment has been minimized.

@wooorm
Copy link
Member

wooorm commented Sep 12, 2023

Ah, glad you quickly found it!

@wooorm wooorm added the 🤷 no/invalid This cannot be acted upon label Sep 12, 2023
@github-actions github-actions bot added 👎 phase/no Post cannot or will not be acted on and removed 🤞 phase/open Post is being triaged manually labels Sep 12, 2023
wooorm pushed a commit that referenced this issue Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤷 no/invalid This cannot be acted upon 👎 phase/no Post cannot or will not be acted on
Development

No branches or pull requests

2 participants