I'm looking at a very small amount of code:
var val = $("#id_input").val();
$("#output").text(val);
Which essentially takes the input into a field, <textarea id="id_input"></textarea>, and outputs it, exactly as it is.
What I'm trying to do is turn input newlines that begin with a - into output <ul><li></li></ul> on my site....
The approach I've been going at is to split the input by lines and then concatenate them, after passing each line through this:
function startsWith(string, pattern) {
return string.slice(0, pattern.length) == pattern;
}
show(startsWith("-"));
I feel like there's a more standard approach though? For example, I've read other posts on StackOverflow that use a find function to produce similar results. I'm suspicious of these because there's no actual regex. It seems too good to be true.

In the image, you can see that green text is comments, white text is input, and black text is output.
I understand that there are existing technologies that have this functionality, but they come with a lot of other functionality. I'm trying to create an input that isolates this functionality.