on-internet
← Community

How to get the value before or between certain unchanging symbols in a dynamic string in JavaScript

Stack Overflow ·

I have a string which contains: abc: def - 01:00, ghi - 02:00 Any part of this string can change, except the order of the dividers in the string i.e. :, -, :, ,, -, and : How do I get the text before the first : and stick it into a variable for later use? And also, how do I get the text between the first - and , and stick that into a different variable?

Comments

Sign in or sign up to comment and upvote.

No comments yet.