I want to get some value from a string. For example:
String string= "Name: armand," + "Age: 22," + "etc";
How can i get for example the name using regular expressions?
I am very bad with regex , so i cant figure out how to solve this.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Depends on what you really want to do, for example if you only want to get the value of a given key, given that key and value are separated by colon and key/value are separated by comma, you can just split in this way string first by comma and then by colon :
If you want to do it with a regular expression you can do in this way :