Hello!
How to capture all values?
Regex: /\{\S+\}/g // https://regexr.com
Hello!
How to capture all values?
Regex: /\{\S+\}/g // https://regexr.com
The /g
isn't regex syntax. That's syntax that some languages use to control the construction/mode of the regex itself.
I tried to make as few changes as possible: Rust Playground
Note that you aren't using capturing groups here, so there is no reason to use captures
.
@BurntSushi thx for your reply.
I have a new problem. I would like to replace a {key}
for value
.
Keys and values are stored in HashMap
.
The second example here should help: Regex in regex - Rust
Here's an updated playground: Regex in regex - Rust
@BurntSushi Incorrect link?
Ah whoops, here it is, thank goodness the playground saves the last program I type.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.