-2

Please help me in extracting the string from this text like

  1. id1:value1,id2:value2

  2. id1:value1a,id2:value2a

from

"[{id1:value1,id2:value2},{id1:value1a,id2:value2a}]"

Santhosh N
  • 25
  • 6

2 Answers2

0

{([^}]+)} will find and capture anything that is inside { }

You should include more detail in your question though and show that you have made an attempt at it yourself.

JackPRead
  • 178
  • 8
  • Thanks for throwing some light on the regex part as i understood a bit more. i found one more way to get it done, jotted down both. unlist(regmatches(text, gregexpr("\\{.*?\\}", text))) unlist(regmatches(text, gregexpr("\\{([^}]+)\\}", text))) – Santhosh N Jan 16 '18 at 12:10
0

Working codes

unlist(regmatches(text, gregexpr("\\{.*?\\}", text)))

unlist(regmatches(text, gregexpr("\\{([^}]+)\\}", text)))

Santhosh N
  • 25
  • 6