-4

How to extract text after "-" in javascript. I have variable with value "15591 - dummy text" I want to get only dummy text after "-". I don want to replace numbers and "-" with space

4
  • You may use split or match. I'm sure it's a multi-duplicate, can somebody find it ? Commented Jun 10, 2014 at 7:37
  • But not a duplicate of that :| Commented Jun 10, 2014 at 7:38
  • So many duplicates, but I would use res = str.replace(/^\d+\s*-\s*/, "") and be done with it. Commented Jun 10, 2014 at 7:39
  • The main issue - that you DID not show your effort. Just simple question without any effort. Welcome to SO anyway. Commented Jun 10, 2014 at 7:40

1 Answer 1

0
var s="15591 - dummy text";
var val = s.split(" - ").pop();
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.