[Question]
  [
Given an ASCII art hexagon as input, output one whose sides are all one unit longer.
```
                     _____
  ____              /     \
 /    \            /       \
/      \          /         \
\       \   =>    \          \
 \      /          \         /
  \____/            \       /
                     \_____/
```
The input hexagons will have 180 degree symmetry, but otherwise the sides can be all different lengths. Above, the side lengths (2, 4, 3) get enlarged to (3, 5, 4). The side lengths will be nonzero.
The hexagons are made of underscores `_`, slashes `/`, and backslashes `\`. Note that of the horizontal edges (made with underscores), the top edge is on its own line but the bottom edge is not.
**I/O**
I'm going to be a stickler and require [ascii-art](/questions/tagged/ascii-art "show questions tagged 'ascii-art'") formatting here: the input and output should be a string with newlines representing the image, not a list of lines. Of course, your code may print each line in turn to produce the image, or read STDIN a line a time for input if your language can do that.
**Details**
The input may include an optional trailing newline if you wish, but will otherwise have no empty lines. You can choose to either have no trailing spaces in the input, or spaces to pad each line to the same length (that of the longest line).
The output should be flush with the left edge of the screen, like the input. You may have extra newlines above and below as well as trailing spaces.
**Test cases**
Input followed by output.
```
 _
/ \
\_/
  __
 /  \
/    \
\    /
 \__/
```
---
```
  ____
 /    \
/      \
\       \
 \      /
  \____/
   _____
  /     \
 /       \
/         \
\          \
 \         /
  \       /
   \_____/
```
---
```
     _
    / \
   /  /
  /  /
 /  /
/  /
\_/
      __  
     /  \
    /    \
   /     /
  /     /
 /     /
/     /
\    /
 \__/
```
**Leaderboard**
```
<iframe src="https://xmikee1.github.io/ppcg-leaderboard/?id=185760" width="100%" height="100%" style="border: none;">Oops, your browser is too old to view this content! Please upgrade to a newer version of your browser that supports HTML5.</iframe><style>html,body{margin:0;padding:0;height:100%;overflow:hidden}</style>
```
  
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 28 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
╙Σ■♀♪«G[▀[TÖe╟╗ê'○▀ÄT→│╧(╡¢╩
```
[Run and debug it](https://staxlang.xyz/#p=d3e4fe0c0dae475bdf5b549965c7bb882709df8e541ab3cf28b59bca&i=+_%0A%2F+%5C%0A%5C_%2F%0A%0A++____%0A+%2F++++%5C%0A%2F++++++%5C%0A%5C+++++++%5C%0A+%5C++++++%2F%0A++%5C____%2F%0A%0A+++++_%0A++++%2F+%5C%0A+++%2F++%2F%0A++%2F++%2F%0A+%2F++%2F%0A%2F++%2F%0A%5C_%2F&a=1&m=1)
Seems like there should be a way to do it mostly with regex, but I'm still looking...
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 84 bytes
```
m`(¶.*)( .)$
$1   $2
(_+¶)(( */)  ( *.))
 _$1 $3$4¶$2
( *.)(_+/)$
$1$.2$*   /¶ $1_$2
```
[Try it online!](https://tio.run/##TYsxDsMwDAN3vYIDB8kFLMTtcww4HTp0aIeib/MD/DFXSYCgXERSvM/j@3zf53ytOnpOpshG4QKARbRdRjdVJDcgTjYTtHjzytvo22QrY@c7xlyYgvXRwaWxzBmpHZLocajKaeHyZ@vpUHfIfw "Retina 0.8.2 – Try It Online") Works with irregular hexagons. I/O is unpadded. Explanation:
```
m`(¶.*)( .)$
$1   $2
```
Widen the interior of the hexagon.
```
(_+¶)(( */)  ( *.))
 _$1 $3$4¶$2
```
Fix up the top.
```
( *.)(_+/)$
$1$.2$*   /¶ $1_$2
```
Fix up the bottom.
[Answer]
# JavaScript (ES6), ~~159 156 153~~ 150 bytes
```
s=>s[r='replace'](/\S /g,'$&   ')[r](/.*/,s=>s[r](e=/_+/,` $&_
`+s[r](e,'/$& \\')[r](e=/_/g,' ')))[r](/ *\\_+/,s=>s[r](e,' ')+`   /
 `+s[r](/_/,'__'))
```
[Try it online!](https://tio.run/##bY8xb4MwFIR3/4onFMUQu7y9kbN1yJShI0YGUZO2QoAw6VL1t9NnaEnc1BN399098V5@lK4a3vrxoe1e7FSryamDywbFB9s3ZWV5HqN@BjxLvtkCAE@ygax0h3Ih89gqNAJlAZutYYVYPMmReK0X3iN@gurJMgA7rX1rHZlDUdAJZPCzQiXJjaHStM8YQARGtxEI/4k0vgrawkiyGQFDb00AafEWnTWEZbjz4NfEq0Wen74eondzyMPBhNdBP5SBCsT8Nyxnad0NT2X1GjtQB/ikqOpa1zU2bbpzzI9tfxkfebL/E7g7h@v2dBn/p2viQQAhPvtKpm8 "JavaScript (Node.js) – Try It Online")
### Commented
```
s =>                       // s = input
  s[r = 'replace'](        // r = alias for 'replace'
                           // STEP #1
    /\S /g,                // insert two middle spaces for all lines
    '$&   '                // that contain a border, followed by a space
  )                        // (i.e. all lines except the first and the last one)
  [r](                     // STEP #2
    /.*/,                  // isolate the first line
    s =>                   // let s be this first line
      s[r](                //
        e = /_+/,          // find the sequence of underscores and replace it with:
        ` $&_\n` +         //   the same sequence preceded by a space and followed by '_'
        s[r](              //   followed by a linefeed and:
          e,               //     the same sequence preceded by '/' and followed by ' \'
          '/$& \\'         //     
        )                  //     with:
        [r](e = /_/g, ' ') //     all underscores replaced with spaces
  ))                       //
  [r](                     // STEP #3
    / *\\_+/,              // isolate the last line, without the trailing '/'
    s =>                   // let s be this last line
      s[r](e, ' ') +       // replace all underscores with spaces
      `   /\n ` +          // append 3 spaces and a trailing '/', followed by a linefeed
      s[r](/_/, '__')      // append s with an extra underscore
  )                        //
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 48 bytes
```
ＳθＷ¬№ω_≔⁺ωＳω≔⊕⊘№ω\η≔⊕⊘№ω/ζ≔×_⊕№ω_θ↗ζθ↓↘η←↙ζ↑←θ↖η
```
[Try it online!](https://tio.run/##jY89a8MwEIZ3/4oj0wlctKdTaIYakhDaZDME46qWQJFcW7Yhf17RVW4Vd@ot9/Xcq1e1rLraVtr7wrSDe3edMg1@sedskkoLwIN1@GIH43DKYXVZMcZg0/eqMXjUQ0/Tx0vGcpjC9YwUpu7EVRgnPvC10mNISawsSS0H@U@eR/yW8JO6ih6DKzKRLv/4zYH@cwz@HK7P7ZtqpIsycUbbvR0Frrd2MgmlboblL7ITn26J0CTKReLcpn3cLZ6PoyDoPcAlRAYcQpTZd6KihJ8K5pJnoSOY@6dR3wE "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
ＳθＷ¬№ω_≔⁺ωＳω
```
Input and concatenate all of the lines except the first. (Input in JSON format would make most of this unnecessary at a saving of 11 bytes.)
```
≔⊕⊘№ω\η≔⊕⊘№ω/ζ≔×_⊕№ω_θ
```
Count the number of `/`s, `/`s, and `_`s in the string and use that to calculate the new side lengths (in the case of `_`s, as a string of `_`s of that length).
```
↗ζθ↓↘η←↙ζ↑←θ↖η
```
Draw the enlarged hexagon.
Alternative solution, also 48 bytes:
```
ＳθＷ¬№ω_≔⁺ωＳω≔⁺θωθＦ²«≔Ｅ\/_⊕⊘№θκη×_⊟ηＭ⁰¬ιＦη«↷¹κ↷¹¶
```
[Try it online!](https://tio.run/##bU4xbsMwDJytVxCaKMCF066dii7pkMJoOgowDFe1hDiSY8v2UOTtKum4QIZy4ZHHu2Nj66EJdZfSm@@neIyD8y1e1LNYrOsM4HuI@BomH3HJQVZSKQUv4@haj2U3jby9VyqVw0Lq@5MLr3Jg0@8wAD4p@BHZdnGoe5RaF5Vko2YwZ@Oj@cJ93c3UbtHkcKJgMrFkkpUUFfHTnc2IkoVl6NEST9whzAZ3OfDfbt2smXbNzEo3h/jhWhvxkbnN6nTD/5NSe8njVVxTAqioBBRApcXaGGj4Q7DBQtDEx0V6mLtf "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
ＳθＷ¬№ω_≔⁺ωＳω≔⁺θωθ
```
Input all of the lines. (Input in JSON format would make this unnecessary at a saving of 17 bytes.)
```
Ｆ²«
```
Draw the top right and bottom left sections of the hexagon separately.
```
≔Ｅ\/_⊕⊘№θκ
```
Count the number of `/`s, `/`s, and `_`s in the string and use that to calculate the new side lengths.
```
η×_⊟ηＭ⁰¬ι
```
Output the top or bottom, and move down a line if this was the top line.
```
Ｆη«↷¹κ↷¹¶
```
Draw both of the right or left sides.
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), ~~75~~ 74 bytes[SBCS](https://github.com/abrudz/sbcs)
```
' /\_'∘{⍺[a×1=(+⍀×a)⌊⊖+⍀⊖×a←2⌈/{⊃0~⍨1⌷⍵,⍨⍉⍵}⌺3 3(0,0,⍨⍉)⍣3⍉⍺⍳↑⍵]}'.+'⎕s'&'
```
[Try it online!](https://tio.run/##7ZK/TgJBEMZ7nmIqF8LpHNKZ@Aq8gGsuG/4okQjhsCAEY9QQQI5IgVhrY2dhiAmlvMm8CM4ud3B70Nh7Bez8bma/mW9ONWqHpbaq1S9WNJ5W69R7dlcCUHqC@q8dChZnajnLnaazFNwtZypDoyENX3TEfwy44JhGfezQ8MG9peAjR6NvCuYOHykY8KlLo0Ue8mnXcUOYoeA9b14uKPii3oSzzrviKCu4B18ciFWFr6VgzHf@fOZ1AvNmkX9bl1V/VdBvx9Obog85F@jpETgqtkWpcu0LE7c4g5uf0@CtyccKK52Uqn6jptqioqo1YaTnTc7lUs7QJ1G/Et1USgHHAsDjBwCEU0gpxyDkEGQcGaLZFkkIWawwZBhDIPX9aArLWpGG90yNqpYFkSo7G4yhjI0xkrJwRE1bWyxhy@OXbDlakhFHu5N139w4Y6V9npQ3lnmWMzEDpIeJOfWMiVHkzhAy2b7VoTT27TTxv7c/700/8d2ty6UFMGEDGgXLY0w4jNYWpGcGTPoGu9/CWt52IWQJDyKDcY/puMdy3GM42suRG6Wdb20NQ/N@AQ "APL (Dyalog Unicode) – Try It Online")
`'.+'⎕s'&'` split input into lines
`↑⍵` mix lines into a matrix
`⍺⍳` replace `' /\_'` with `0 1 2 3`
`(0,0,⍨⍉)⍣3⍉` surround with a layer of 0s on top&bottom and two layers of 0s on the left&right
`{⊃0~⍨1⌷⍵,⍨⍉⍵}⌺3 3` for each cell choose the first non-0 from: upper, lower, left, right from the 3x3 neighbourhood centred on it
`2⌈/` max in pairs horizontally
`a×1=(+⍀×a)⌊⊖+⍀⊖×a←` keep only the outer boundary of non-0s
`⍺[` `]` replace `0 1 2 3` with `' /\_'`
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 126 bytes
```
$args-replace' *\S +','$0   '-replace'( +)(_+)','$1 $2_
$1/$2 \'-replace'( *)(\\_+)/','$1$2   /
$1 $2_/'-replace'_(?=.* )',' '
```
[Try it online!](https://tio.run/##ZZLNTsMwEITvfopRZYjzU0x7r8g7cLVkRcW0h4iGpIhKpc8e1ms7GPDBO1rPfLsHD6dPN05H1/ezfMUO11l242Faj27ou70rUJln1EVTyEcAxdJXqEtl69K/bCC3VsiNlluY3FKVyhgyaXbRK6BFsOsfn1VPu4cKHoVivgnRKiEa1a4EYOkIaArCCC5eGCSFKDV5jTdrsWobjnKWwiHtvXqJJZXDfvESMtOBzwPKtJ8lEhGyqXHdOCLSKW7@JP2xXDyBC08JhW@@cjZnQijMiAILAQsEiYOI4vp/mxJfuMOVUfLoLt3h9NZAusvg9mf3Qj9CholydNNHf6bGPX2UZM2f1u59yeV9cZu/AQ "PowerShell – Try It Online")
[Answer]
# [Perl 5](https://www.perl.org/), ~~177~~ ~~156~~ 145 bytes
```
@l=pop=~/.+/g;splice@l,$_,0,$l[$_]=~s,_, ,gr for-1,1;$l[$_]=~s, (\S)( +)(\S),$_<2?" $1$2 $3":"$1$2   $3",e for 1..@l-2;join("\n",@l)=~s,_+,$&_,gr
```
Could be shorter? Don't see how just yet. With comments and added newlines and header+footer:
```
sub f {
@l=pop=~/.+/g;                                                      #1
splice@l,$_,0,$l[$_]=~s,_, ,gr for-1,1;                             #2
$l[$_]=~s, (\S)( +)(\S),$_<2?" $1$2 $3":"$1$2   $3",e for 1..@l-2;  #3
join("\n",@l)=~s,_+,$&_,gr                                          #4
}
```
[Try it online!](https://tio.run/##ZZJRT4MwEMff@ykupHHUdaugvgxRvoBP@mZNo6abmA4IZTHLsn11pC0dzeSBu971//tfcm1kq@57vfuE9aEvVN7UTX5iyznbZLpR5ZcsFMWC3lCs3rB4z0@aCgp008K6bhcJTbKpATF/ITHMiYmD6iF9igAnOAV8G60im4HJqTRqSJbLQi3S7KcuqzjiVUQLRazDnOIrMZj0R7TdQ9FJ3eXxDIH9hIsMOHIRGJqiC@7PBZvRs@ysm4RjylwDBZlPfORjnQvDRBYqkJ@Cj6DJULimKXsfi/DXx6EDnEAOdmYIWxlKI@BihHEG4Z0mr8At8JscRTBlIA/03hQC539kB@RwCR/oiGRopyW8DotbrZ7rVoLZoc4f7zL0@10qGdulkoPdxHYf47KiuN51JN9@NKAZ19e8YqylMD5Dc314hmlmFU1bVh2sjYy4Sqljd3SYDB37Pw "Perl 5 – Try It Online")
Line #1 splits multi-line input string into the @l array.
Line #2 duplicates second and last lines without the \_ chars.
Line #3 adds spaces where needed on line 2 to second last.
Line #4 widens the two \_\_\_ sides with one \_ and returns the @l array of lines as one multi-line string.
]