i have this string pattern:
Name: bondy
address: kuta, bali
age: 20
i want to get the name value of Name
i did regex like this:
/(?<=Name:)(.*)(?=[\n\r])
but somehow it reads until the last newline?
i have this string pattern:
Name: bondy
address: kuta, bali
age: 20
i want to get the name value of Name
i did regex like this:
/(?<=Name:)(.*)(?=[\n\r])
but somehow it reads until the last newline?
(.*)
is greedy and will try to match everything. Add a ?
right after the asterisk to have it be less greedy.
(.*?)
tested and worked.