Multiple replacements in a string are not working properly
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- javascript, react
- 領域
- frontend
研究方向
從 ReactStringReplace 呼叫和 issue 中的正規表示式範例開始,然後使用提供的字串重現記錄的比對結果。追蹤替換 callback 的呼叫方式,並判斷為什麼會回報中間文字;當回報的比對結果和替換行為符合 issue 中所述的預期時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
I am using react-string-replace for translations. I have a string and I want to replace a couple of substitutes.
The code looks like this:
ReactStringReplace(
'[link]This is my link[/link] available everywhere or [shortcode].',
/(\[link\].*\[\/link\])|(\[shortcode\])/g,
(match) => {
console.log('match', match);
}
)
From my understanding, my regular expression should match only the first link and the [shortcode]. But the result in the console looks like this:
match [link]This is my link[/link]
match available everywhere or
match [shortcode]
I don't understand why is the middle match there. It doesn't match the regular expression.
- 主要語言
- JavaScript
- 星號
- 665
- 分支
- 54
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
iansinnott/react-string-replace 的其他 Issue
-
難度 4/5 3-5 天 新手友好度 35/100
-
難度 3/5 1-2 天 新手友好度 35/100
-
難度 3/5 1-2 天 新手友好度 35/100
iansinnott/react-string-replace#89 · 1 個 reaction ·
-
難度 2/5 1-3 小時 新手友好度 38/100
-
難度 3/5 1-2 天 新手友好度 30/100
iansinnott/react-string-replace#64 · 2 則留言 · 2 個 reaction ·
查看 iansinnott/react-string-replace 的全部 Issue
相似的 Issue
-
change request evaluating
難度 2/5 1-3 小時 新手友好度 72/100
sindresorhus/eslint-plugin-unicorn#3907 ·
維護者通常 1 天內回覆
-
Android bug feature/error-tracking react-native team/error-tracking
難度 2/5 1-3 小時 新手友好度 72/100
PostHog/posthog-js#5310 · 1 則留言 ·
維護者通常 1 天內回覆
-
Add Prettier and a format-check CI job可能已有人在做 @ezekielnathaniel070-ai 今天認領。 未關閉backend frontend good first issue Stellar Wave
難度 2/5 1-3 小時 新手友好度 75/100
OlaGreat/starbound-realms#98 · 1 則留言 ·
-
app request good first issue help wanted self-hosted app
難度 2/5 1-3 小時 新手友好度 75/100
Secra-Solutions/Conector#15 ·
-
Complexity: See issue making label epic good first issue Issue Making: Level 1 P-Feature: Project Info and Page role: back end/devOps role: front end size: 0.25pt time sensitive
難度 2/5 1 小時以內 新手友好度 65/100
維護者通常 1 天內回覆