[Question]
  [
You should write a program or function which receives a string representing a chessboard with only pawns as input and outputs or returns whether any capture is possible on the board.
Input is in a [FEN](https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation)-like notation describing positions of white and black pawns with no other pieces present. You should decide if there is a pawn which can capture an enemy one.
> 
> Each rank is described, starting with rank 8 and ending with rank 1; within each rank, the contents of each square are described from file "a" through file "h". Each pawn is identified by a single letter (white pawn = "P", black pawn = "p", ). Empty squares are noted using digits 1 through 8 (the number of empty squares), and "/" separates ranks. *(partially taken from Wikipedia)*
> 
> 
> 
For example
```
8/pppppppp/8/8/4P3/8/PPPP1PPP/8
```
describes the board
```
--------
pppppppp
    P   
PPPP PPP
--------
```
A white pawn can capture a black one if the black one is positioned diagonally up from it (black is up-left or up-right) and a black pawn can capture a white one if the white one is diagonally below from it (white is down-left or down-right). No other capture move ([en passant](https://en.wikipedia.org/wiki/En_passant)) should be considered.
## Input
* A [FEN](https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation)-like string consisting of the characters `12345678pP/`.
* The input describes the pawns of a valid chess game position. This means (among other more complex constraints) there will be at most 8 pawns for each side and no pawns on ranks 1 and 8.
## Output
* If there is a possible capture for either side you should output a [truthy](http://meta.codegolf.stackexchange.com/a/2194/7311) value and a [falsy](http://meta.codegolf.stackexchange.com/a/2194/7311) value otherwise.
## Examples
Inputs with **truthy** output (one per line)
```
8/7p/6P1/8/8/8/8/8
8/8/p7/1P6/3P3p/8/8/8
8/2P5/8/4P1p1/2p2P2/3p4/3p1P2/8
8/P7/8/5P2/2pp4/3P2p1/3pP3/8
8/P7/p7/p1P1P3/1P3p2/8/1p6/8
8/4p1P1/2P2P1P/2p1pPpp/8/6P1/pP1p4/8
```
Inputs with **falsy** output (one per line)
```
8/8/8/8/8/8/8/8
8/7P/6p1/8/8/8/8/8
8/7p/7P/8/8/8/8/8
8/pppppppp/8/8/8/8/PPPPPPPP/8
8/p7/8/1p6/5P2/8/8/8
8/p7/P7/2P1p1p1/2p5/8/PP6/8
```
This is code golf so the shortest entry wins.
  
[Answer]
# [Retina](https://github.com/mbuettner/retina), ~~33~~ 29 bytes
```
T`d`w
)`\d
$0.
_
p.{7}(..)?P
```
To run the code from a single file, use the `-s` flag.
Should be easily beatable by something like Perl where the expansion of digits into strings of spaces (or other characters) doesn't take up 17 bytes.
The output is positive (truthy) if there is a possible capture and zero (falsy) if there isn't.
## Explanation
```
T`d`w
)`\d
$0.
```
This is a loop of two stages. The first one is a transliteration stage which decrements each digit, and turns zeroes to underscores. Why? Because `d` and `w` expand to the following two lines:
```
0123456789
_0123456789AB...YZab...yz
```
If the target set of a transliteration stage is longer than the source set, the extraneous characters are ignored, hence the decrementing behaviour (honestly, it was just luck that I decided to put the underscore in front of the digits when expanding the `w` character class).
Then the second stage is a replacement, which appends a `.` to each digit. That means that for each digit `n`, `n` periods are added before that digit is turned into an underscore.
```
_
<empty>
```
This just gets rid of the underscores.
```
p.{7}(..)?P
```
Finally, we find the matches. Since we're ignoring en passant, captures are only possible if there is a `p` and then a `P` diagonally below it. In the linear string, this simply means that there must be 7 or 9 characters between the two pawns. This matched with `.{7}(..)?` (i.e. match 7 characters and then, optionally, match another two).
Such a match stage returns the number of matches it found.
[Answer]
# Pyth, 25 bytes
```
/smC,>JsXz`M9*LN9dJ,8T"Pp
```
[Test suite](https://pyth.herokuapp.com/?code=%2FsmC%2C%3EJsXz%60M9%2aLN9dJ%2C8T%22Pp&test_suite=1&test_suite_input=8%2F7p%2F6P1%2F8%2F8%2F8%2F8%2F8%0A8%2F8%2Fp7%2F1P6%2F3P3p%2F8%2F8%2F8%0A8%2F2P5%2F8%2F4P1p1%2F2p2P2%2F3p4%2F3p1P2%2F8%0A8%2FP7%2F8%2F5P2%2F2pp4%2F3P2p1%2F3pP3%2F8%0A8%2FP7%2Fp7%2Fp1P1P3%2F1P3p2%2F8%2F1p6%2F8%0A8%2F4p1P1%2F2P2P1P%2F2p1pPpp%2F8%2F6P1%2FpP1p4%2F8%0A8%2F8%2F8%2F8%2F8%2F8%2F8%2F8%0A8%2F7P%2F6p1%2F8%2F8%2F8%2F8%2F8%0A8%2F7p%2F7P%2F8%2F8%2F8%2F8%2F8%0A8%2Fpppppppp%2F8%2F8%2F8%2F8%2FPPPPPPPP%2F8%0A8%2Fp7%2F8%2F1p6%2F5P2%2F8%2F8%2F8%0A8%2Fp7%2FP7%2F2P1p1p1%2F2p5%2F8%2FPP6%2F8&debug=0)
Steps:
Transform the input by replacing the digits with the equivalent number of quote marks (`N`). This is saved in `J`. We then slice off the first 8 or 10 characters, and zip the result with the original. Any capturing pair will be transformed into `"Pp"`, so we then find the count of that string in the resultant list. This is the output.
As a bonus, this actually counts the number of captures possible in the input.
[Answer]
# Javascript, 272 characters
```
function h(t){b=[[]];for(i=-1;i++<7;){c=0;b.push(l=[]);for(j=-1;j++<7;){o=t.split('/')[i][j];switch(o){case'P':l[c++]=-1;break;case'p':l[c++]=1;break;default:c+=parseInt(o);}}}b.push([]);for(i=1;i<9;i++)for(j=0;j<8;j++)if((p=b[i][j])&&(b[i+p][j-1]||b[i+p][j+1]))return 1;}
```
There's probably a lot of room for improvement.
[Answer]
# Ruby, ~~145 123~~ 46 bytes
```
->b{b.gsub(/\d/){|x|?.*x.to_i}=~/p.{7}(..)?P/}
```
I don't know why I didn't think about this in the first place. It's much shorter and also pretty readable.
Here's the test: <http://ideone.com/Gzav8N>
---
The old approach:
```
->b{l={}
r=p
b.split(?/).map{|s|c={}
i=0
s.chars.map{|x|n=x.to_i;c[i]=x;i+=n<1?1:n;x==?P&&r||=l[i-2]==?p||l[i]==?p}
l=c}
r}
```
Online test: <http://ideone.com/9L01lf>, version before golfing: <http://ideone.com/CSmqlW>
A history of modifications is available [here](https://github.com/wolfascu/codegolf/commits/master/59147-capture-on-the-pawn-chessboard/59147-capture-on-the-pawn-chessboard-golfed.rb).
[Answer]
## ES6, 64 bytes
An appropriate byte count, if it lasts!
```
f=s=>/p.{7}(..)?P/.test(s.replace(/\d/g,n=>"        ".slice(-n)))
```
I actually thought of this solution without reading the other answers first, but I won't mind if you don't believe me.
[Answer]
# [Pip](https://github.com/dloscutoff/pip), 21 bytes
```
`p.{7}(..)?P`NaRXDsX_
```
[Verify all test cases!](https://tio.run/##VU8xDsIwDNx5RUcYiJWkbbqxsIIspm4tE2JBJxirvj2cS1vRRI6cO599xhN5yD3ckMa9c4eT9tf7rT1/2i6Phfu4rrgUj9xIgtTqpVnuzl4k8VpL1IgVDVoxK9XDS0DQIBElwzMzXhPpip8AwzWwLkLjQrInaz0BBqgRj3oiS8PZP5Cl2kNhY80WOK6cTTUbk0mlxtY3VyH6j2A@K6jz@bFpNmGuV0kys8HWnBatJhWN5uP79QU "Pip – Try It Online")
### Explanation
Same regex-based solution as most of the other answers.
```
`p.{7}(..)?P`NaRXDsX_
              a        1st command-line argument
               R       Replace
                XD      regex matching a digit
                  sX_   with space repeated that many times
             N         Count occurrences of
`           `           this regex:
 p                       A black pawn
  .{7}                   followed by any 7 characters
      (..)?              optionally followed by 2 more characters
           P             followed by a white pawn
```
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 47 bytes
```
'p.{7}(..)?P'{≢⍺ ⎕S⍬⊢⍵}('\d'⎕R{' '⍴⍨⍎⍵.Match})⍞
```
I wanted to make a matrix based matching solution for this, but Martin Ender's Regex ended up being simpler.
[Try it online!](https://tio.run/##XVC7TsQwEOzzFel8VxDLzsPp6OiQVkBJE3E6rojECo4iilLzkHwdJRRUFJTQ8Dn7I2EcfHCcLUv2zOzujBtuDxZd015djnJ/txwVZ70bZlk2PyTVy8Or@K9UNk@n4t/lEa/PYabOFwrQSa9SJf5D/Jv4DZjsuFlfrIa5@JfQbBT/nJ5d365XXbJMau1YV2R0vd0TWGt22lClc8p5B7dU4l6QYaMtW7I65wLH4PajIAdBiaflwJCFMmfK/2h0ht4AwmHUacNVpIvAYIoFjw6GicP4YJAxtIAsCf6Pmvami07rPe@OdMX7gZAS@H@M4/qFKa4t76K3EGenzIUUNvzB9AvlVBkSfAM "APL (Dyalog Unicode) – Try It Online")
## Explanation
```
'p.{7}(..)?P'{≢⍺ ⎕S⍬⊢⍵}('\d'⎕R{' '⍴⍨⍎⍵.Match})⍞
                                              ⍞ String input
                            ⎕R                  Perform Regex replacement
                        '\d'                    match all digits   
                              {' '⍴⍨⍎⍵.Match}   Execute match(convert to number), replace with that many spaces
             {≢⍺ ⎕S⍬⊢⍵}                         Tally number of matches of left argument in right
'p.{7}(..)?P'                                   Match two opposite colored pawns 7-9 spaces apart                        
```
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), ~~55~~ 51 bytes
```
t=>/p.{7}(..)?P/.test(t.replace(/\d/g,i=>'1e'+i-1))
```
[Try it online!](https://tio.run/##VVDbboMwDH3vjzSoaywnQJAm2C/4A/ZQlKYVEypWQXuZ9u3MZpStiRw55/hy7I/2sx3jvePpeBvOab7U81Q3wPYrfBtrszcCO6VxMpO9J@7bmAy8n@H60tXNHtP@0B0xy@bX066CwFASQvW4O305AFIJnjxvqKNCvJyQERw7cuA5F0PxlKcgdCEfx4qTkzjP5B@k1JRYFECMJQeQy4XMFZf6TljJRibWtiqLpV2@iqqeRAaCkp91yyiC/kd4PRtI6/llwypCVW8pQcU6HXMZtFiyVOjpb5n2IMuMdROH2zj0yfbD1VxMzGSpPw "JavaScript (Node.js) – Try It Online")
Replace numbers with spaces, then
```
12345678/
 P1234567
p   P1234
56789p
P1234567p ; attempt to make P and p not in neighbor line
       P1 ; and fail
23456789p
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt) v2.0a0, 21 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
Adaptation of [Neil's solution](https://codegolf.stackexchange.com/a/69469/58974).
```
r\dÈ°çÃè/p{7ç.}(..)?P
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=2.0a0&code=clxkyLDnw%2bgvcHs35y59KC4uKT9QLw&footer=VmdX%2biBtKyIgPT4gIiApKyEhVQ&input=WwoiOC83cC82UDEvOC84LzgvOC84IgoiOC84L3A3LzFQNi8zUDNwLzgvOC84IgoiOC8yUDUvOC80UDFwMS8ycDJQMi8zcDQvM3AxUDIvOCIKIjgvUDcvOC81UDIvMnBwNC8zUDJwMS8zcFAzLzgiCiI4L1A3L3A3L3AxUDFQMy8xUDNwMi84LzFwNi84IgoiOC80cDFQMS8yUDJQMVAvMnAxcFBwcC84LzZQMS9wUDFwNC84IgoiOC84LzgvOC84LzgvOC84IgoiOC83UC82cDEvOC84LzgvOC84IgoiOC83cC83UC84LzgvOC84LzgiCiI4L3BwcHBwcHBwLzgvOC84LzgvUFBQUFBQUFAvOCIKIjgvcDcvOC8xcDYvNVAyLzgvOC84IgoiOC9wNy9QNy8yUDFwMXAxLzJwNS84L1BQNi84IgpdLW1S) (Includes all test cases)
[Answer]
# Perl 5, 30 bytes
29, plus 1 for `-pe` instead of `-e`
```
s/\d/1x$&/ge;$_=/p.{7}(..)?P/
```
A Perl copy of [w0lf's Ruby answer](/a/59155).
[Answer]
# PHP, ~~94~~ ~~87~~ 80 bytes
```
for(;$i++<8;)$t[$i]=$s.=" ";echo preg_match("#p.{7}(..)?P#",strtr($argv[1],$t));
```
That loop+`strtr` is a lot shorter than `preg_replace_callback` with `str_pad`.
[Answer]
## Jelly, 88 84 79 72 69 65 64 63 60 bytes
Definitely room for improvement.
```
ØDṖḊ
”_x
e1£¬
1£iÐ€2Ŀ€
x"3Ŀ€;"ÇFṣ”/
w€⁾pPn0
5ĿUŒDÇ
5ĿŒD6ĿoÇS
```
]