I have multiple lines of text in a following format .
Hello {user}, you have been awarded {x} points for being active for more than {y} days.
How do I extract these specific variables using Regex?
e.g. -
Hello john, you have been awarded 10 points for being active for more than 2 days.
Upon extracting, I should get john (user), 10 (x) and 2 (y) from above line.
p.s. - I am using java and I need to get it done using regex.
Hello ([^,]+)- The first group contains the name. Do the same for others. If you have control on creating the string, I wouldn't recommend using regex.Hello (\\w+), you have been awarded (\\d+) points for being active for more than (\\d+) daysshould do"I have many such string formats"- what does this mean? Give an example of one of the "other" formats.