I want to create a RegExp that takes in a variable as part of the string.
I am parsing a list of options and I want to select the option based on if it's text contains a number but the problem is that just using .includes('1') will select 1: and 10:
I want the RegExp to do this:
/^{myNumber}:/
The option list I am trying to sort has numbers that look like this:
1: this is a string
2: comment
3: option
let locatedTask = $task.find('option').filter(function() {
if($(this).text().includes('1')){
return $(this).html();
}
});