user1506: Is there some easy way to check whether the black king is on e8 or the white king is on e1, when using fen?

Here the black and white king are on d1/8 r2k3r/3q4/8/8/8/8/8/R1QK2RR
Here both are on the right field r3k2r/3q4/8/8/8/8/8/R1Q1K1RR

The problem is that there is really no regularity, to check by indexing whether the King is on e1/e8.

The fen above, could also be rb2k2r/3q4/8/8/8/8/8/R1Q1K1RR and would still be valid.

Checking for the rocks are pretty easy, since they have to be at the beginning or the end of the fen.

user1506: Thanks to Henry for the tip. Here is my solution.
var kingOnRightField = function (groundRow, king) {
    var index = 0;

    for (var i = 0; i < groundRow.length; i++) {
        var number = parseInt(groundRow[i]);
        index += isNaN(number) ? 1 : number;

        if (index == 5 && groundRow[i] == king) return true;
    }

    return false;
};

var fen = "r3k2r/3q4/8/8/8/8/8/R1Q1K1RR";

var blackGroundRow = fen.split("/")[0];
var whiteGroundRow = fen.split("/")[7];

var blackKingOnRightField = kingOnRightField(blackGroundRow, 'k');
var whiteKingOnRightField = kingOnRightField(whiteGroundRow, 'K');


1506: <p>Is there some easy way to check whether the black king is on e8 or the white king is on e1, when using fen?</p>
<blockquote>
<p>Here the black and white king are on d1/8 <code>r2k3r/3q4/8/8/8/8/8/R1QK2RR</code></p>
<p>Here both are on the right field <code>r3k2r/3q4/8/8/8/8/8/R1Q1K1RR</code></p>
</blockquote>
<p>The problem is that there is really no regularity, to check by indexing whether the King is on e1/e8.</p>
<blockquote>
<p>The fen above, could also be <code>rb2k2r/3q4/8/8/8/8/8/R1Q1K1RR</code> and would still be valid.</p>
</blockquote>
<p>Checking for the rocks are pretty easy, since they have to be at the beginning or the end of the fen.</p>
 1506: <p>Thanks to Henry for the tip. Here is my solution.</p>

<pre><code>var kingOnRightField = function (groundRow, king) {
    var index = 0;

    for (var i = 0; i &lt; groundRow.length; i++) {
        var number = parseInt(groundRow[i]);
        index += isNaN(number) ? 1 : number;

        if (index == 5 &amp;&amp; groundRow[i] == king) return true;
    }

    return false;
};

var fen = "r3k2r/3q4/8/8/8/8/8/R1Q1K1RR";

var blackGroundRow = fen.split("/")[0];
var whiteGroundRow = fen.split("/")[7];

var blackKingOnRightField = kingOnRightField(blackGroundRow, 'k');
var whiteKingOnRightField = kingOnRightField(whiteGroundRow, 'K');
</code></pre>
