Needs some help with using a reg ex to get the machine name from a string. Note there are also new lines between the name/value pairs. Here is the string:
event has happened on id=5656565655, login.user.id=5453453345, machine.name=ubuntu-1, more name value pairs here
The regex that I though was working was:
final Matcher m = Pattern.compile("machine.name=(\\.+),")
I had a W instead of the DOT before, but that missed machine names with numerics and dashes in them. Once I went to DOT I get zero matches. I need to extract the value of the machine name from the string. Will someone help me out?
By putting a
\in front of the dot, you are asking for a literal dot. What you probably want is everything up to the comma, which can be done withor with a non-greedy modifier: