Home>

I'm reading the JavaScript code, but in the middle of the code there is a variable called "mi"
It came out. Is this a variable? Is it the type of code notation?

The following code is excerpted.

var variable C = match&&match [1]? match [1]: data.SampleData;
if (!/^ String A: [\ t]? /mi.test (variable C)) {
    match = variable C.match (/ string B: [\ t]? (. * (?: \ R? \ N \ s +. *) * \ R? \ N)/mi);


Speaking of mi, I can only think of an editor, and I thought it might be a regular expression.
I'm sorry for the question that is too rudimentary, but thank you.

  • Answer # 1

    Isn't it a "regular expression flag"?

    [Regular expression --JavaScript | MDN]
    https://developer.mozilla.org/ja/docs/Web/JavaScript/Guide/Regular_Expressions#Advanced_Searching_With_Flags

  • Answer # 2

    m = multiline, i = ignoreCase

    RegExp.prototype.multiline

    RegExp.prototype.ignoreCase

  • Answer # 3

    It's a regular expression.
    Reference regular expression

    Please refer to the [Advanced Search Using Flags] section of the above site.
    It's a composite of m (multi-line match) and i (case insensitive) instead of mi.