Match method
var str = "IID0000FFR"; var substr = Str.match (/id (\s*) ff/); Console.log (SUBSTR)
The returned result is: ["id0000ff", "0000"]
The \s* expression in () matches all strings
In high-level languages, we use a concept called quantitative words:
(? =ff) This represents the preceding string with the FF ending, but does not include the FF
var str = "IID0000FFR"; var substr = Str.match (/(\s*) (? =ff)/); Console.log (SUBSTR)
return array: ["iid0000", "iid0000"]
(iid=?) This represents a string that begins with the IID, but does not include the IID
var str = "IID0000FFR"; var substr = Str.match (/(iid=?) (\s*)/); Console.log (SUBSTR);
return array: ["IID0000FFR", "IID", "0000FFR"]
Get back and forth the middle string as the first example
var str = "IID0000FFR"; var substr = Str.match (/(iid=?) (\s*) (? =FFR)/); Console.log (SUBSTR);
return array: ["iid0000", "iid", "0000"]
JS is intercepting a string between two strings