JSFiddle - React, Tailwind, and code Playground
JavaScript
var v = 20; // Variable part of search query
var str = "The rain 20 in SPAIN stays mainly in the plain"; // String to search
var n = str.match('ain ' + v); // The searching, returns null if not found or the matches found. Notice the 'ain' string has been added (this can of course be changed)
if(n != null){
alert(n + ' found!');
}else{
alert(v + ' not found...');
}