Я пытаюсь найти предложение, которое выглядит примерно так:
I'm a sentence with some text and number and so on 45
В базовой строке, которая может выглядеть так, как текст уценки:
Here is some content \n \n > Listing some items: - Hello, I'm *** bold ***. \n \n I'm a \n
\n sentence with - some text and number and so on 45
Я сталкивался с этим вопросом, который использует Regex, но я не могу заставить его работать в моем примере. Я также немного изменился, но безуспешно:
const content = "Here is some content \n \n > Listing some items: - Hello, I'm *** bold ***. \n \n I'm a \n \n sentence with - some text and number and so on 45"
const search = "I'm a sentence with some text and number and so on 45"
const regex = '[^a-zA-Z0-9]*?';
const searchTerm = search.split("").join(regex);
var matches = content.match(searchTerm);
console.log(matches);
Я пробовал разные переменные регулярного выражения, например: '[^ a-zA-Z0-9] ?', '[ ^ \ w \ d \ s] 'и' [. \ -] '
Заранее спасибо