Reputation: 2089
I've been having trouble writing a Regex to grab text starting with a colon and getting everything that follows along with optionally ending when another colon is found. It's for emoji markdown autocompletion. So typing
The expression I have now just grabs everything after the first colon:
const myRe = /\:(.*)$/g;
const result = myRe.exec(inputValue);
Upvotes: 2
Views: 635
Reputation: 786011
You can use this regex:
var re = /:([^:]*)/;
and grab captured group #1
Upvotes: 3