[Question]
  [
# Introduction
We -- especially the geeks among us, who tend to be fans -- all remember this old *Far Side* cartoon:
[![Hey! Hey! Hey!](https://i.stack.imgur.com/L3GcY.jpg)](https://i.stack.imgur.com/L3GcY.jpg)
Clearly, Professor Schwartzman could have brushed up on his programming skills just a wee bit more before he put his invention to use. But can you replicate it yourself... using as few bytes as possible?
# Input Specs
You must create a script that translates dog sounds into appropriately intonated "Hey"s. This is pure code golf; the lowest number of bytes wins.
Your input will consist of some combination of the following tokens:
* `Bark`, `Baark`, `Baaark`, `Baaaark`, ... (that is, `B*rk` with at least 1 `a` replacing the asterisk)
* `Woof`, `Wooof`, `Woooof`, ... (`W*f` with at least **2** `o`s replacing the asterisk)
* `Grr`, `Grrr`, `Grrrr`, ..., (`G` followed by at least **2** `r`s)
* Any number of `.` (period), `!` (exclamation mark) and/or `?` (question mark) characters, which may occur anywhere in the input
Note, again, that the `Woof`-based and `Grr`-based tokens always require at least **two** `o`s and `r`s respectively; `Wof` and `Gr` are *not* valid tokens.
There is no limit on how long a token can be (e.g., how many repeated `a`s there can be in a `Bark` token); however, your decoder only needs to work correctly for input tokens with **up to 10** total `a`s, `o`s, or `r`s to pass this challenge.
# Output Specs
Faithful to Schwartzman's design, your canine decoder program must process it into output text as follows:
* `Bark`, `Woof`, and `Grr` become `Hey`;
* `Baark`, `Wooof`, and `Grrr` become `Heyy`;
* `Baaark`, `Woooof`, and `Grrrr` become `Heyyy`; etc.
* For all `Bark`-based tokens, the number of `y`s in the output `Hey`-based token must be equal to the number of `a`s;
* For all `Woof`-based tokens, the number of `y`s in the output `Hey`-based token must be **one less than** the number of `o`s;
* For all `Grr`-based tokens, the number of `y`s in the output `Hey`-based token must be **one less than** the number of `r`s;
* All punctuation (`.`, `!`, and `?`) is left unchanged.
Remember to drop one `y` from the output for `Woof`s and `Grr`s only! The input `Baaaaaaaark?`, with 8 `a`s, will become `Heyyyyyyyy?`, with a matching set of 8 `y`s. However, `Woooooooof?` becomes only `Heyyyyyyy?`, with 7 `y`s.
Again, if you can get your program to work for input tokens of unlimited size, that's great, but for purposes of this challenge, your program will only be checked to ensure that it works properly for input tokens that have no more than 10 repeated letters.
All `Bark`-, `Woof`-, and `Grr`-based tokens in your input are assumed to begin with capital letters. Therefore, there is *no need* to handle turning `Bark grrr` into `Hey heyy` or anything similar.
# Example Inputs and Outputs
1. * Input: `Bark. Bark! Bark!!`
	* Output: `Hey. Hey! Hey!!`
2. * Input: `Baaaaaark?` (six `a`s)
	* Output: `Heyyyyyy?` (six `y`s)
3. * Input: `Grrrrrrrr...` (eight `r`s)
	* Output: `Heyyyyyyy...` (**seven** `y`s)
4. * Input: `?...!`
	* Output: `?...!`
5. * Input: `Wooof Woof? Grrrr. Baaaark Grr!`
	* Output: `Heyy Hey? Heyyy. Heyyyy Hey!`
  
[Answer]
## [Retina](https://github.com/m-ender/retina), ~~24~~ ~~18~~ ~~17~~ 16 bytes
*1 byte saved based on an idea in MT0's answer.*
```
\wf?k?
y
\byy
He
```
[Try it online!](http://retina.tryitonline.net/#code=XHdmP2s_CnkKXGJ5eQpIZQ&input=QmFyay4gQmFyayEgQmFyayEhCkJhYWFhYWFyaz8KR3JycnJycnJyLi4uCj8uLi4hCldvb29mIFdvb2Y_IEdycnJyLiBCYWFhYXJrIEdyciE)
### Explanation
```
\wf?k?
y
```
This simply turns all letters into `y`, but if they are followed by an `f` or `k` we immediately replace that as well. By removing `f` and `k` we "normalise" the lengths of the words so that they now all have two more `y`s than they need.
```
\byy
He
```
This turns the first two `y` of every word into `He`, completing the transformation.
[Answer]
## Perl, 51 41 39 bytes
```
s/(G.|[BW]..)(\w+)/He."y"x length$2/ge
```
### Usage
```
perl -pE 's/(G.|[BW]..)(\w+)/He."y"x length$2/ge'
```
### Input
```
Bark. Bark! Bark!!
Baaaaaark?
Grrrrrrrr...
?...!
Wooof Woof? Grrrr. Baaaark Grr!
```
### Output
```
Hey. Hey! Hey!!
Heyyyyyy?
Heyyyyyyy...
?...!
Heyy Hey? Heyyy. Heyyyy Hey!
```
### How it works
Simple regexp substitution using the auto-printing `-p` adding 1 byte to the count. `/ge` executes the substitution for every pattern, and runs the replacement as code.
---
An older version used a three-way detection, but [Martin Ender](https://codegolf.stackexchange.com/users/8478/martin-ender) noticed that I was not aggressive enough, which saved me 10 bytes.
[msh210](https://codegolf.stackexchange.com/users/1976/msh210) informed me that you don't need quotes around the string `He`, saving two bytes.
[Answer]
# Python, 106 bytes
```
f=lambda s,a="B,He,Gr,He,Wo,He,a,y,r,y,o,y,f,,yk,".split(","):s if a==[]else f(s.replace(a[0],a[1]),a[2:])
```
**Demo**
<https://repl.it/C6Rr>
[Answer]
# Vimscript, ~~51~~ ~~39~~ ~~37~~ ~~33~~ ~~32~~ ~~29~~ 28 bytes,
```
%s/\hk\?f\?/y/g|%s/\<yy/He/g
```
Regex credits for shaving 9 more bytes: MT0, Martin Ender, msh210 
[![asciicast](https://asciinema.org/a/50280.png)](https://asciinema.org/a/50280)
*Demo*
Explanation:
```
                               1. Normalize words to same length & replace letters with ys 
%s                             Regex search and replace 
  /                            Regex search begin
   \hk\?f\?                    Find any letter (\h) optionally followed by k or f
           /                   Regex search end and replace start
            y                  Replace with y
             /                 Replace end
              g                Replace globally
               |               New command
                               2. Overwrite first two y of every word with He
                %s             Regex search and replace
                  /            Regex search begin
                   \<yy        Find yy at a word's beginning
                        /      Regex search end and replace start
                         He    replace with He
                           /   Replace end
                            g  Replace globally
```
[Answer]
# JavaScript (ES6) - ~~57~~ ~~55~~ ~~52~~ 51 Bytes
```
f=s=>s.replace(/\wk?f?/g,'y').replace(/\byy/g,'He')
```
Test:
```
f=s=>s.replace(/\wk?f?/g,'y').replace(/\byy/g,'He');
[
  'Bark. Bark! Bark!!',
  'Baaaaaark?',
  'Grrrrrrrr...',
  '?...!',
  'Wooof Woof? Grrrr. Baaaark Grr!'
].forEach( s=>{console.log( f(s) );} );
```
Thanks to @MartinEnder for bytes 56 & 51 and the inspiration for some of the other shavings.
[Answer]
# Perl 5, 25 bytes
A Perl copy of [Martin Ender's Retina answer](/a/83871). 24 bytes, plus 1 for `-pe` instead of `-e`.
```
s;\wf?k?;y;g;s;\byy;He;g
```
[Answer]
# Javascript, ~~72~~ ~~66~~ 64 Bytes
```
f=
t=>t.replace(/k|f/g,'').replace(/\w/g,'y').replace(/\byy/g,'He')
```
Edit: separated `f=` and function + reduced byte count
[Answer]
## Pyke, 35 bytes
```
.cFDlR\G.^+3-\y*"He"R+)Rdc~lL-],AsJ
```
[Try it here!](http://pyke.catbus.co.uk/?code=.cFDlR%5CG.%5E%2B3-%5Cy%2a%22He%22R%2B%29Rdc%7ElL-%5D%2CAsJ&input=Wooof+Woof%3F+Grrrr.+Baaaark+Grr%21)
Generates Heys, Generates punctuation, zips together, joins
[Answer]
# Python 3, ~~140~~ ~~135~~ 134 bytes
```
from re import*
f=lambda s:''.join('He'+'y'*len(x)+y for x,y in[(a+b+c,d)for a,b,c,d in findall('(?:Wo(o+)f|Gr(r+)|B(a+)rk)(\W+)',s)])
```
Using regex to find occurences of replacable characters.
**Edit:** Golfed 1 byte whitespace and 4 bytes on getting the values from findall result.
**Edit2:** Golfed 1 byte (Bark's "a" was not counted properly)
]