2

"I expect five hundred dollars <Sample500>. and new brackets <600> next < Sample>".

in the above sentence i want to get the strings between "<" and ">" like ["Sample500","600"," Sample"]

for that i'm using the regular expression like -->

"I expect five hundred dollars <Sample500>. and new brackets <600> next <Sample>".match(/\<<[^>]+>\>/g)

please provide valid regular expression

2 Answers 2

3

this will do the trick for you:

var s = "I expect five hundred dollars <Sample500>. and new brackets <600> next <Sample>";
var matches = [];
s.replace(/<(.*?)>/g, function(g0,g1){
  matches.push(g1);
});
console.log(matches);
Sign up to request clarification or add additional context in comments.

Comments

2
<([^>]*)>

You can try this.See demo.

http://regex101.com/r/kM7rT8/1

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.