javascript - regexp to get value inside [:(value here):] -


मेरे पास निम्न स्ट्रिंग है

  var str = ": [: {Business AddressId @ Business_Address / (: [:( सड़क का पता):]: [:( शहर):],: [:( राज्य):]: [:( पोस्टल कोड):]: [देश:])]}}: ";   

और मुझे अंदर मूल्यों को निकालना होगा: []:] ताकि मैं मूल्यों की एक सरणी प्राप्त कर सकूं [स्ट्रीट एडेस, सिटी, स्टेट, पोस्टल कोड, कंट्री]। अब तक मुझे निम्नलिखित regexp मिला है

  / \ [\: \ ((। *?) \) \: \] \) / G   < पी> कोड  
  var s = str.match (/\[\:\((.*?)\)\:\]\)/ जी) console.log (एस)   

रिटर्न

 ["[: (सड़क का पता):]: [:( शहर):],: [:( राज्य):]: [:( डाक कोड):]: [:( देश):]) "]  

यह ठीक नहीं है कि मुझे क्या चाहिए और मैं regexp के साथ बहुत अच्छा नहीं हूं।

  var arr = str.match (/: \ (([^)] +) \): / g) .map (फ़ंक्शन ( X) {return x.replace (/: | \ (| \) / g, "");}); console.log (आगमन); // ["सड़क का पता", "शहर", "राज्य", "डाक कोड", "देश"]   

उपरोक्त होगा। < / html>

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -