Hi I am new to regular expression and this may be a very easy question (hopefully).
I am trying to use one solution for 3 kind of string
The easiest way with an exact search string is to skip regular expressions and just use indexOf
, e.g.:
// String to be searched
var s = "Here is a link."
// String to find
var searchString = "";
// Final match
var matched = "";
var c = s.indexOf(searchString);
if (c >= 0)
{
// Returns the portion not including the search string;
// in this example, "Here is a link". If you want the
// search string included, add the length of the search
// string to c.
matched = s.substring(c);
}