[Question]
  [
# Introduction
My car speedometer was hacked! Instead of showing me how fast i'm driving, it just shows: "Vroooom!" Please help me know how fast i'm going.
# Challenge
Take a string as input, and check if it matches the regex `/^[Vv]ro*m!$/m`. In English that means any line of the string must start with a capital or lowercase `v`, then a lowercase `r`, then any amount (including zero) of the lowercase letter `o`, then the exact string `m!`. There may be other lines, but the Vroom string must be on it's own line.
If you find a match, then you must count the amount of `o`'s in the Vroom string and output it. If you don't find a match however, you should output any default value that can't be outputted otherwise (like `-1` or an empty string)
# Reminders
* I/O is in [any reasonable format](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods)
* [Standard loopholes](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default) are banned
* Submission may be a full program or function
* Input is guaranteed to only have 1 Vroom string
# Scoring
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the [shortest code](https://codegolf.meta.stackexchange.com/questions/10145/how-to-count-bytes-faq) in bytes wins. **However**, I will not mark any answer as accepted.
# Test cases
**Input**
```
Vrom!
```
**Output** `1`
**Input**
```
vrooooooom!
```
**Output** `7`
**Input**
```
Hello, Vroom!
```
**Output** `(none)`
**Input**
```
Foo bar boo baz
Vrooom!
hi
```
**Output** `3`
**Input**
```
Vrm!ooo
```
**Output** `(none)`
**Input**
```
PPCG puzzlers pie
```
**Output** `(none)`
**Input**
```
hallo
vROOOm!
```
**Output** `(none)`
  
[Answer]
# [sed 4.2.2](https://www.gnu.org/software/sed/), 20 bytes
`-nr` options required at the command-line.
```
s/^[Vv]r(o*)m!$/\1/p
```
This outputs the speed in [unary](https://codegolf.meta.stackexchange.com/a/5349/11259) as the number of `o`s.
[Try it online!](https://tio.run/##K05N@f@/WD8uOqwstkgjX0szV1FFP8ZQv@D/f7f8fIWkxCKFJDBdxRVWlJ@fn6vIlZH5L7@gJDM/r/i/bl4RAA "sed 4.2.2 – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), ~~56~~ 53 bytes
```
lambda x:len(re.search('^[Vv]r(o*)m!$',x,8).group(1))
```
[Try it online!](https://tio.run/##HcmxCsIwEADQvV9xDULvpBR0EsHVT@giCommJtDkwjWV6s/H0ukNL32z43gsPiSWDGLLcBl1MC8Ny3m0EcV2k9XydNg8bv3nLsh7CvWuaZf2RN1beE54ICpJfMwwoFLqygxGC5jNX9ULM4e6cn5NKn8 "Python 2 – Try It Online")
Basic regex and grouping, uses re.MULTILINE flag (which has a value of 8) and re.search to ensure it works for multiline inputs. Raises an exception when no match is found. Thanks to @ovs for the -3 bytes from `(re.M == 8)` tip.
[Answer]
# [R](https://www.r-project.org/), ~~62 60 58~~ 44 bytes
```
nchar(grep("^[Vv]ro*m!$",readLines(),v=T))-4
```
[Try it online!](https://tio.run/##K/r/Py85I7FII70otUBDKS46rCy2KF8rV1FFSacoNTHFJzMvtVhDU6fMNkRTU9fkv1t@vkJSYpFCEpiu4gorys/Pz1Xkysj8DwA "R – Try It Online")
@Giuseppe with 14 bytes golfed. 
Original approach with explanation:
```
function(x)attr(el(regexec("(?m)[Vv]r(o*)m!$",x,,T)),"m")[2]
```
[Try it online!](https://tio.run/##K/qfpmCj@z@tNC@5JDM/T6NCM7GkpEgjNUejKDU9tSI1WUNJwz5XMzqsLLZII19LM1dRRUmnQkcnRFNTRylXSTPaKPZ/moZSWFE@EOQqKmlygXmJCCaM5ZGak5Ovo8AFUQpWzRWeX5STApT/DwA "R – Try It Online")
R has seven pattern matching functions. The more commonly used ones are `grep`, `grepl`, and `sub`, but here's a nice use for `regexec`.
`regexec` gives you a bunch of things, one of which is the length of any captured substring, in this case the `(o*)` part of the multiline regex. 
The `attr(el .... "m")[2]` stuff is a golfy way to get the desired number.
Returns `NA` if there is no match.
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 41 bytes
```
a=>(l=/[Vv]r(o*)m!/.exec(a))&&l[1].length
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@z/R1k4jx1Y/OqwstkgjX0szV1FfL7UiNVkjUVNTTS0n2jBWLyc1L70k439yfl5xfk6qXk5@ukaaRoJbfr5CUmKRQhKYruIqK8rPz89V5MrITNDUtP4PAA "JavaScript (Node.js) – Try It Online")
[Answer]
# Powershell, ~~62~~ ~~58~~ ~~53~~ 48 bytes bytes
```
"$($args|sls '(?m-i)^[Vv]ro*m!$'|% M*)".Length-4
```
returns numbers of `o` in a first `Vroom!`, or -4 if `Vroom!` not found.
Notes:
* `sls` is alias for [Select-String](https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Select-String);
* `(?m-i)` inside regexp means:
	+ Use multiline mode. `^` and `$` match the beginning and end of a line, instead of the beginning and end of a string.
	+ Use case-sensitive matching
* `|% M*` is [shortcut](https://codegolf.stackexchange.com/a/111526/80745) for the property `Matches`, which gives a first match because we don't use `-AllMatches` parameter.
Test script:
```
$f = {
"$($args|sls '(?m-i)^[Vv]ro*m!$'|% M*)".Length-4
}
@(
,('Vrom!',1)
,('vrooooooom!',7)
,('Hello, Vroom!',-4)
,('Foo bar boo baz
Vrooom!
hi',3)
,('Vrm!ooo',-4)
,('PPCG puzzlers pie',-4)
,('hallo
vROOOm!',-4)
,('
Vrooom!
Vrooooom!
',3)        # undefined behavior.
,('vrm!',0) # :)
) | % {
    $n,$expected = $_
    $result = &$f $n
    "$($result-eq$expected): $result"
}
```
Output:
```
True: 1
True: 7
True: -4
True: 3
True: -4
True: -4
True: -4
True: 3
True: 0
```
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 83 bytes
```
($args-split"`n"|%{if(($x=[regex]::Match($_,"^[Vv]ro*m!$")).success){$x}}).length-4
```
[Try it online!](https://tio.run/##HcWxDoIwEADQna@ApobWCJMTiaubKwtBLU2lTQpH7qo2It9eE9/yFngbJGu8T0lwhSNVtHgX2H1m393qHkLweOrQjCb2TXNRQVvBbwd27dpXj7CfCs6krOmptSGSK4/bJmtv5jHY6phSKs8A@aAwH/5/shYBYCoy68of "PowerShell – Try It Online")
`-split`s the input `$args` on ``n`ewlines, pipes those into a for loop. Each iteration, we check whether our `[regex]::Match` is a `.success` or not. If so, we leave `$x` (the regex results object) on the pipeline. Outside the loop, we take the `.length` property -- if it's the regex results object, this is the length of the match (e.g., "Vroom!" would be 6); if it's not a regex results object, the length is zero. We then subtract `4` to remove the counts for the `Vrm!` and leave that on the pipeline. Output is implicit. Outputs a `-4` if no match is found.
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 21 bytes
```
L$m`^[Vv]r(o*)m!$
$.1
```
[Try it online!](https://tio.run/##K0otycxLNPz/30clNyEuOqwstkgjX0szV1GFS0UPKOyWn6@QlFikkASmq7jCivLz83MVuTIyAQ "Retina – Try It Online") Explanation: `L` lists matches, so if the regex fails to match then output is empty. `$` causes the result to be the substitution rather than the match. `m` makes it a multiline match (the equivalent to the trailing `m` in the question). The `.` in the substitution makes it output the length of the capture in decimal.
[Answer]
# [SNOBOL4 (CSNOBOL4)](http://www.snobol4.org/csnobol4/), ~~99~~ 82 bytes
```
I	INPUT POS(0) ('V' | 'v') 'r' ARBNO('o') @X 'm!' RPOS(0)	:F(I)
	OUTPUT =X - 2
END
```
[Try it online!](https://tio.run/##K87LT8rPMfn/35PT0y8gNEQhwD9Yw0BTQUM9TF2hRkG9TF1TQb1IXcExyMnPX0M9H8h1iFBQz1VUVwiCKOW0ctPw1OTi9A8NAem3jVDQVTDicvVz@f/fLT9fISmxSCEJTFdxhRXlg0CuIldGJgA "SNOBOL4 (CSNOBOL4) – Try It Online")
Pretty direct SNOBOL translation of the spec, reads each line until it finds one that matches `^[Vv]ro*m!$`, then outputs the length of the `o*` bit.
Enters an infinite loop if no `Vroom!` can be found.
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 26 bytes
```
{-!/^^[V|v]r(o)*m\!$$/+$0}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPu/WldRPy4uOqymLLZII19TKzdGUUVFX1vFoPZ/cWKlQpqGSrymQlp@EZdSWn5@TF5ZUX5@rmJMXlJikZIOl1JZUa4iiA4DCoMBhAtUlav0HwA "Perl 6 – Try It Online")
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 188 183 bytes
Why use regexes when you can use a state machine instead? :-)
```
a,b;f(char*s){for(a=b=0;a<5;s++){!a&*s==86|*s=='v'?a++:a==1&*s=='r'?a++:a==2?*s-'o'?*s-'m'?0:a++:b++:a==3&*s==33?a++:!*s&a==4?a++:*s-10?(a=-1):a-4?(a=0):a++;if(!*s)break;}s=a<5?-1:b;}
```
[Try it online!](https://tio.run/##fVPbjtowEH33VxiqJXYuVbJsqxVZNw/V0lZCZVWpfQEekpCA1VxQ7ERaaL6djhPMpVUbgew553g8ZyaJnU0cH9/wIs7qdYKfhFzz8u32A7qGKl5s/sTWGY8AO4Z25Kck3oaVKeghLSsSsoi5fvj0zheWRQ@DcGQKxh7f/1KL0RhBaFmTkDGvw43qDNwHpnCM0uiW3AjciSKinhx36vG4Ew9MMQLsoQtA7bkBXOt4dBI6D2rrUnXW5ykBKY2qJPzpt4JBUYHjTSK/PaqKsblJZF5nkpPpl9kzNlOKDwjjnhM2jm0c1eni0V2xg9v6QPFCKigu60LaGFpz2gGWJQUTfJ@UKYGI@gjkqh@Cff0@m13ETJ@HLmESsxSKiElK6YA9z6d@XwLc1KXphaxPrymMBQNLWVbGRFwSW73K8qivZbIq4t0rEdZNpbrca12f4XTRGV9oZsWMpWto/MpBh7TohC40Y1krFitSUVdWtIV/Gug32sL/DPT5TrrFXzkuFbdqElUi66rAwkcQqinmIS9IU/L1zczZ@Y1QX0JBbWzClWYN/0bPn59HK5nwsYQpSlbT0YhAA@@pttiwvHfoWYQzQmoGNcKPQMLhslgWQ0qD2pETwKDnRFJ4bm03NgYxP6HNgl@PYQefpUzJ8E5ghu/WkM/GcCAljU6TVkkCkR5DFwoI2@OPqswHCDVV2T8q@JxAtTYGqgunZYkj6EnUrXukcEVsOYJ9PoAIoZeXj5/wrt7vs6QSeMcThLbKNGq@zefzfPAb "C (gcc) – Try It Online")
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 16 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
∞╠mQ╛3mQ->n▀÷↕┐ò
```
[Run and debug it](https://staxlang.xyz/#p=eccc6d51be336d512d3e6edff612bf95&i=Vrom%21%0A%0Avrooooooom%21%0A%0AHello,+Vroom%21%0A%0AFoo+bar+boo+baz%0AVrooom%21%0Ahi%0A%0AVrm%21ooo%0A%0APPCG+puzzlers+pie&a=1&m=1)
[Answer]
# [Haskell](https://www.haskell.org/), ~~75~~ ~~71~~ 69 bytes
```
f s=[length n-2|r<-lines s,n<-scanr(:)"m!"$'o'<$r,v<-"Vv",r==v:'r':n]
```
[Try it online!](https://tio.run/##HcWxCsMgEADQPV9xEcEWtENH0bWfkKV0MMFUqbmDUyyU/ruFvuWlUF@xlDF2qP5eIj5bAjTXLztTMsYKVaMzdQvIJ3sWxyykIuUk6@6MWLrQ7H23ipXFxzhCRvCQsUUOWwMJNdEbLrCPGxGsgWH9/5kWJqJjnlL@AQ "Haskell – Try It Online")
No regex. Instead builds all valid `Vrooom!`-strings up to a sufficient length and compares the lines of the input against them, collecting the number of `o`s in a list. Thus for invalid inputs an empty list is returned.
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~104~~ 100 bytes
```
s;main(c,n){for(;gets(&s);sscanf(&s,"v%*[o]%nm%c%c",&n,&c,&c)-1||c-33?:printf("%d",n-2))s=s-768|32;}
```
[Try it online!](https://tio.run/##JYxBC4JAFITv71eswoobu4cSKpLoEFQ3pUOX6KAvLcHdlV3zYPbbba3hwcz3BgbFA3EcbSyzSoXIFXuX2oTxo2htGFgWW4uZKl3kfkdnV32jSlKk6PNA8QDdMTEfBhRRtNs0plJtGfr07nMlFozZrRWr5XqIFvFnHC9GSw@gM/qvCU5FXWtOXPXDg9YkzwzJf97D9J@KZwUuS88RQJruj6R59X1dGEuaqgB4Zm4GunOSJNL7Ag "C (gcc) – Try It Online")
Output the `n` for each valid line, exactly in the requirement(nothing if no valid line, the `n` if exactly one)
```
int s; // Use as a char[]
main(c){
  while(gets(&s)) {
    s=s-768|32; // byte 0: 'V'=>'v'; byte 1: 'r'=>'o', 'o'=>'l'
    if (sscanf(&s,"v%[o]m%c%c",&s,&c,&c)==2 && c=='!') {
    // The last '%c' get nothing if it's EndOfLine
      printf("%d",strlen(&s)-1))
    }
  }
}
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 18 bytes
```
fè`^[Vv]*m!$` ®èo
```
[Try it online!](https://ethproductions.github.io/japt/?v=1.4.6&code=ZuhgXltWdl2eKm0hJGAgruhv&input=W1siVnJvbSEiXSwKWyJ2cm9vb29vb29tISJdLApbIkhlbGxvLCBWcm9vbSEiXSwKWyJGb28gYmFyIGJvbyBiYXoiLCJWcm9vb20hIiwiaGkiXSwKWyJWcm0hb29vIl0sClsiUFBDRyBwdXp6bGVycyBwaWUiXSwKWyJoYWxsbyIsInZST09PbSEiXV0KLVFt)
Saved a byte by taking input as an array of lines.
Includes an unprintable character between `]` and `*`.
Explanation:
```
fè                   Get the line(s) that match
  `^[Vv]*m!$`          The provided RegEx with a little compression
              ®èo    Count the number of "o" in that line if it exists
```
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 138 124 bytes
Here's the boring regex way.
```
#include<regex.h>
f(char*s){regmatch_t m[9];regcomp(m+2,"^[Vv]r(o*)m!$",5);s=regexec(m+2,s,2,m,0)?-1:m[1].rm_eo-m[1].rm_so;}
```
[Try it online!](https://tio.run/##fVNdb9owFH33rzBsbW0SKkCatDX1@jCVbhIa1aT1JbAKjAOW4hjZTrSB@O3sOsF8bNoiEL7nHB/f4xt4d8n5/o0seF4uBL63biH17eojOoeMLJZ/YotczgE7br03Yil@elVG@GpmOpZuAVIzx1evDqv0wzSBmmu1JioaxO0f6Us1NUR3qGq9bcfvaGJZ7SF4LbDxIFZxjz50@3cq7U9vjXoVuhuWVie7vT8Id5bCqTJ3kgy/jB5xJ6N4izBuOBtjHuN5maXve1O27e0SoGThPMR1WbgYQ77DCrBcFMzKjdAZgYomCOSZNsSyr99Ho5OYhf2sl2DCWQZNcJJR2mKP42HStAAn1TaNkDX2gcLY553luebEnoyjRhX1aRJkzhR8/YvY6KLT0O65rnE4HHTE08BM2c2kdxPwswQ1skMHNA1MFE0Z96SnzqKECP8M0CxChP8FaPwOuvQvj1PHOz8JI1xpCmwTBKWfoprJglRaLi5mzo5vhH@dCxrjDhzZKeFbhfnL42gdswl2MEXHSnp9TeACBzRErJhqEvYjIhkhJYMe4UPAsD0pJkWb0oey6@4AgzsnjsJzGbuKMYjlAa1SeT6GNfy3XEbaVxYzfLUAvxjDhoxUwSYzQkAVxlCXFsrd/sVo1UKoMrp5fPFZQLcxBqouh1rjOdzJvP7dII97YiURrFULKoSenz894XW52eTCWLyWAqGVD42qb@PxWLV@Aw "C (gcc) – Try It Online")
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 28 bytes
```
IJjb.nm:rd0"^vro*m!$"1.z/J\o
```
[Try it online!](https://tio.run/##K6gsyfj/39MrK0kvL9eqKMVAKa6sKF8rV1FFyVCvSt8rJv///@T8lFSF9PycNK6wovz8/FxFrozUnJx8AA "Pyth – Try It Online")
[Answer]
# Pyth, 20 bytes
```
/R\o:#"^Vro*m!$"1cQb
```
Outputs as a list containing only the number of 'o's, or an empty list if there's no Vroom.  
[Try it here](http://pyth.herokuapp.com/?code=%2FR%5Co%3A%23%22%5EVro%2Am%21%24%221cQb&input=%22Foo%20bar%20boo%20baz%5CnVrooom%21%5Cnhi%22&debug=0)
### Explanation
```
/R\o:#"^Vro*m!$"1cQb
                 cQb  Split on newlines.
    :#"^Vro*m!$"1     Filter the ones that match the regex.
/R\o                  Count the `o`s in each remaining element.
```
[Answer]
# [Pip](https://github.com/dloscutoff/pip), 21 bytes
```
a~,`^[Vv]r(o*)m!$`#$1
```
[Try it online!](https://tio.run/##K8gs@P8/sU4nIS46rCy2SCNfSzNXUSVBWcXw////YUW5ivn5@VxlQfn5uYpcZUVADpABAA "Pip – Try It Online")
Match regex `^[Vv]r(o*)m!$` in multiline mode; output length of capture group.
[Answer]
# [sfk](http://stahlworks.com/dev/swiss-file-knife.html), 94 bytes
```
xex -i -case "_[lstart][char of Vv]r[chars of o]m![lend]_[part 4]o_" +linelen +calc "#text-1" 
```
[Try it online!](https://tio.run/##HYxBCsMgEEX3OcWPXQYXhZ6hR8hGBjF2QqQmU1SC9PLWZvV4j8/P67u1yhU6QHuXGcqamItLhYzfXIKsmE9Kl@S/Ce2jiXy8yJpP3@FBYhWmGA7uGZN30UPdCtei7wqtPUWw9Kvl4neYk@zjsIUf "sfk – Try It Online")
Gives `-1` when you're not vrooming.
[Answer]
# [Red](http://www.red-lang.org), 104 bytes
```
func[s][n:""if parse/case s[opt[thru"^/"]["V"|"v"]"r"copy n any"o""m!"opt["^/"to end]][print length? n]]
```
[Try it online!](https://tio.run/##bY0xb4MwFIR3/4rHzY2yZ@lQKc1GlIHFciUHngsS2NazQQptfzuBZkxuueG@uxNulgs32ih3WNzoa52M9gegcxStJN7XNjElHWLWuZURX3sYjQq/mGAgqEO8kSfrbwjAUGAjNyoHYt8Yo6N0PlPP/ju37@SNWRwRJgkPrRX1QLDbBOUIJ@778EaVvM5/jiHQ1Qpd/31WG7iSqu3@nscqGYo1Bj3vtHb9UdOlLMuheFE9nz8@KY7z3LMkih1DLXc "Red – Try It Online")
A straightforward solution. Red's `parse` is cool and readable, but too long compared to regex
```
Red []
f: func [ s ] [
    n: ""
    if parse/case s [
             opt [ thru newline ]
             [ "V" | "v" ]
             "r"
             copy n any "o"
             "m!"
             opt [ newline to end ]
    ] [ print length? n ]
]
```
[Answer]
# J, 35 bytes
```
(]{~0<{.)(1{'^[Vv]r(o*)m!'rxmatch])
```
Returns negative 1 if the pattern doesn't match.
[Answer]
## JavaScript, 90 73 61 bytes
```
_=>_.replace(/^[Vv]r(o*)m!$|[^\1]/mg,(m,a)=>a||'').length||-1
```
[Try it online!](https://tio.run/##TYzLCoMwEEX3fkWEgknxgR9gN4V2qXThxvqINj5K4ki0UiT/bq2IeDcz99yZ@6Yj7QvZdIPVwovNpTen3iW1Jes4LRh2kigcY4nhTIR@UlHydGNHVCYWJiXehSplGMTmrK2GWinLnQtoe@DM5lDhEmejhIOE/tUWIvSMmGhJw8O@X@7kBoByKlG@zkkL5ZpqdbO/C31BmwuC6x11n2niTPaoa9jGa8o5aOPD9/1/NZl/)
Replace characters that are not captured at `(o*)` with empty string, return `length` of string containing only `"o"` or `-1` if resulting string is empty.
[Answer]
# Ruby, 32 bytes
```
->n{n=~/^[Vv]r(o*)m!$/m;$1.size}
```
Matches the string to the regex, then uses Ruby's magic regex group variables to get the first group's size.
Call it like so:
```
x=->n{n=~/^[Vv]r(o*)m!$/m;$1.size}
x["Vrooooooooooooooooooooom!"] # returns 21
```
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~28~~ 29 bytes
```
p$_[/^[vV]r(o*)m!$/].count ?o
```
[Try it online!](https://tio.run/##KypNqvz/v0AlPlo/LrosLLZII19LM1dRRT9WLzm/NK9EwT7///@wovxcRa6yIjCRnw/ieKTm5OTrKIC4QF5YkL@v4r/8gpLM/Lzi/7p5AA "Ruby – Try It Online")
Multi-line strings require three more bytes. I'm not sure if that's a hard requirement. If so, I'll update this.
```
->l{l[/^[Vv]r(o*)m!$/].count ?o}
```
[Answer]
# [Clojure](https://clojure.org/), 90 bytes
```
#(do(def a(clojure.string/replace % #"(?ms).*^[Vv]r(o*)m!$.*""$1"))(if(= a %)-1(count a)))
```
[Try it online!](https://tio.run/##JchBCoAgEADAr2ymsCtk@IDoF12iQNSiqAy1vm@H5jj2CPsTfSk1uoDOL2DQ/qdSjtu1ttHfh7EeBNQM@zORkvM4vFPEIOmsuJKMcc2IcFuwAwOCGo02PFcGQ0SlfA "Clojure – Try It Online")
This anonymous function returns the number of "o"s in the vroom string, or -1 if there is no valid vroom string.
### Readable version
```
(fn [s]
  (def a (clojure.string/replace s #"(?ms).*^[Vv]r(o*)m!$.*" "$1"))
  (if (= a s) -1 (count a)))
```
### Explanation
```
#"(?ms).*^[Vv]r(o*)m!$.*" ; This regex matches any string that contains a valid vroom string. The first capturing group contains only the "o"s in the vroom string
(clojure.string/replace s #"(?ms).*^[Vv]r(o*)m!$.*" "$1") ; Replaces a match of the above regex with its first capturing group. The resulting string is stored in the variable a
(if (= a s) -1 (count a))) ; a equals s if and only if there is no valid vroom string, so if a equal s we return -1. If there is a valid vroom string, a contains only the "o"s from the vroom string, so we return the length of a
```
[Answer]
# perl -nE, 35 bytes
```
$s=length$1if/^[Vv]r(o*)m!$/}{say$s
```
This uses the *Eskimo greeting* (`}{`) which abuses the a quick on how the `-n` option is dealt with by perl. 
[Answer]
# Java 8, 109 bytes
```
s->{int r=-1;for(var l:s.split("\n"))r=l.matches("[Vv]ro*m\\!")?l.replaceAll("[^o]","").length():r;return r;}
```
[Try it online.](https://tio.run/##lVA9b8IwEN35FYenuIJIXYloVVVquxRQkbIQKjnBEFPHjs4moqD89vQSGLpUpB5s@fye38deVGK833w1mRbOwbtQ5jwAUMZL3IpMwqy9dgPIgqVHZXbgeETDekCb88KrDGZgYNq48cO5BeJ0fB9tLQaVQNATF7pSKx@wxDDOcarDQvgsly5gq7hao70rkmTI@KMOUZaaVJ@0prdPu2Yjxniopdn5POATjFD6AxrAqG6iVr88pJr0rzYqqzZQUIar09UaBL8EWH47L4vQHnxY0pPXJjBhFrAYbUHaXaK/URXay@qBfZNa2xHQx33QL9ZCSjWl3XlKTMsjYmJydZMcYzEk9E3cYvH8SlWdTlqig1LJm4xcUIjEVB/z@bxHiiNBsTV97OFZ/Kfwa@udQJ8@4@p37/Wgbn4A)
**Explanation:**
```
s->{                             // Method with String parameter and integer return-type
  int r=-1;                      //  Result-integer, starting at -1
  for(var l:s.split("\n"))       //  Loop over the lines:
    r=l.matches("[Vv]ro*m\\!")?  //   If the current line matches the regex:
       l.replaceAll("[^o]","").length()
                                 //    Change `r` to the amount of "o"'s in it
      :                          //   Else:
       r;                        //    Leave the result `r` unchanged
  return r;}                     //  Return the result
```
[Answer]
# [C# (.NET Core)](https://www.microsoft.com/net/core/platform), 134 122 bytes
```
for(var a="";a!=null;a=Console.ReadLine())if(new Regex(@"^[Vv]ro*m!$").Match(a).Success)Console.Write(a.Count(x=>x=='o'));
```
[Try it online!](https://tio.run/##XY3NagIxFIX3fYo7g2AiNC8QUirSnW6q2EVp4RKvNpDJbfMzRsRnn2ZTkJ7dOXC@z6ZHy5Gmklw4wfaSMg0a7ptau/Dzb9pRzeqVTsVjfKnfkVJyHJJ@sB5TgiVcIWXMzsLI7gAbdEFIuE5HjmLECGj6XmNnQvFeo1m1L3tqRDw0Gwkp3VEEOkNzUBXP/ef7fvyIvBi6WS/VBrP9EijVtljb3PIP8BZdJoFqxSVkUc1TNWbOcyn1dLtN@8j3Gbpf "C# (.NET Core) – Try It Online")
*-12 bytes: moved* `null` *check into* `for` *loop and removed brackets*
Ungolfed:
```
for(var a = ""; a != null; a = Console.ReadLine())  // initialize a, and while a isn't null, set to new line from console
    if(new Regex(@"^[Vv]ro*m!$")                        // set regex
                        .Match(a).Success)              // check if the line from the console matches
        Console.Write(a.Count(x => x == 'o'));              // write the number of 'o's to the console
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~39~~ 37 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
|ʒć„VvsåsÁÁD…m!rÅ?s¦¦¦Ù'oså)P}Dgi`'o¢
```
Although 05AB1E is a golfing languages, regex-based challenges are definitely not its strong suite, since it has no regex-builtins.
Outputs `[]` if no match was found.
[Try it online](https://tio.run/##yy9OTMpM/f@/5tSkI@2PGuaFlRUfXlp8uPFwo8ujhmW5ikWHW@2LDy0DwcMz1fOBkpoBtS7pmQnq@YcW/f/vlp@vkJRYpJAEpqu4yoryE0EwVxHIBOrOBzPygQDICCtKTATLBPn7KnJlZAIA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfeX/U5OOtD9qmBdWVnx4afHhxsONLo8aluUqFh1utS8@tAwED89UzwdKagbUuqRnJqjnH1r0v1bnf3S0UlhRfq6iUqyOQrRSWVE@BMAEPFJzcvJ1FIBK4EJu@fkKSYlFCklgukpJB2QAWFpHKSMToiasKFcRKAbhBAQ4uysUlFZV5aQWFSsUZKZChDMSgUYD9ZQF@fv7@8IdgNsaoOMSQRBsE0hhUT6UmQ@zP6woMREqHwQyE@EiuPrYWAA).
**Explanation:**
```
|              # Get the input split by newlines
 ʒ             # Filter it by:
  ć            #  Head extracted: Pop and push the remainder and head-character
               #   i.e. "vrm!" → "rm!" and "v"
               #   i.e. "Vroaom!" → "roaom!" and "V"
   „Vvså       #  Is this head character in the string "Vv"?
               #   i.e. "v" → 1 (truthy)
               #   i.e. "V" → 1 (truthy)
  s            #  Swap so the remainder is at the top of the stack again
   ÁÁ          #  Rotate it twice to the right
               #   i.e. "rm!" → "m!r"
               #   i.e. "roaom!" → "m!roao"
     D         #  Duplicate it
      …m!rÅ?   #  Does the rotated remainder start with "m!r"?
               #   i.e. "m!r" → 1 (truthy)
               #   i.e. "m!roao" → 1 (truthy)
  s¦¦¦         #  Remove the first three characters from the duplicated rotated remainder
               #   i.e. "m!r" → ""
               #   i.e. "m!roao" → "oao"
      Ù        #  Uniquify, leaving only distinct characters
               #   i.e. "" → ""
               #   i.e. "oao" → "oa"
       'oså   '#  Is this uniquified string in the string "o"?
               #   i.e. "" → 1 (truthy)
               #   i.e. "oa" → 0 (falsey)
  )P           #  Check if all three checks above are truthy
               #   i.e. [1,1,1] → 1 (truthy)
               #   i.e. [1,1,0] → 0 (falsey)
 }             # Close the filter
  D            # After the filter, duplicate the list
   gi          # If its length is 1:
               #   i.e. ["vrm!"] → 1 (truthy)
               #   i.e. [] → 0 (falsey)
     `         #  Push the value in this list to the stack
               #   i.e. ["vrm!"] → "vrm!"
      'o¢     '#  And count the amount of "o" in it (and output implicitly)
               #   i.e. "vrm!" → 0
               # (Implicit else:)
               #  (Implicitly output the duplicated empty list)
               #   i.e. []
```
[Answer]
## C++, MSVC, ~~164~~ 159 bytes
-5 bytes thanks to Zacharý
It compiles even with the `regex` header only
```
#include<regex>
using namespace std;int f(vector<string>i){smatch m;for(auto&e:i)if(regex_match(e,m,regex("^[Vv]ro*m!$")))return m[0].str().size()-4;return-1;}
```
Tests :
```
std::cout << "Vrom!" << " -> " << f({ "Vrom!" }) << '\n';
std::cout << "vrooooooom!" << " -> " << f({ "vrooooooom!" }) << '\n';
std::cout << "Hello, Vroom!" << " -> " << f({ "Hello, Vroom!" }) << '\n';
std::cout << "Foo bar boo baz \\n Vrooom! \\n hi" << " -> " << f({ "Foo bar boo baz", "Vrooom!", "hi" }) << '\n';
std::cout << "Vrm!ooo" << " -> " << f({ "Vrm!ooo" }) << '\n';
std::cout << "PPCG puzzlers pie" << " -> " << f({ "PPCG puzzlers pie" }) << '\n';
std::cout << "hallo \\n vROOOm!" << " -> " << f({ "hallo", "vROOOm!" }) << '\n';
```
]