How fast am I vrooooming?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
4
down vote

favorite
1












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


  • Standard loopholes are banned

  • Submission may be a full program or function

  • Input is guaranteed to only have 1 Vroom string

Scoring



This is code-golf, so the shortest code 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)










share|improve this question























  • Is raising an error on no Vroom acceptable? Alternatively, can I return a list with the speed and use the empty list for no Vroom?
    – Mnemonic
    1 hour ago










  • @Mnemonic Sure.
    – FireCubez
    1 hour ago










  • Suggest adding a testcase with uppercase r, o and/or m.
    – Shaggy
    43 mins ago










  • What's the correct output for Vrm!?
    – Neil
    22 mins ago










  • Usually, I'd complain about requiring input validation, but, in this challenge, it's exactly what separates it from a normal "find the length" challenge.
    – Erik the Outgolfer
    22 mins ago














up vote
4
down vote

favorite
1












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


  • Standard loopholes are banned

  • Submission may be a full program or function

  • Input is guaranteed to only have 1 Vroom string

Scoring



This is code-golf, so the shortest code 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)










share|improve this question























  • Is raising an error on no Vroom acceptable? Alternatively, can I return a list with the speed and use the empty list for no Vroom?
    – Mnemonic
    1 hour ago










  • @Mnemonic Sure.
    – FireCubez
    1 hour ago










  • Suggest adding a testcase with uppercase r, o and/or m.
    – Shaggy
    43 mins ago










  • What's the correct output for Vrm!?
    – Neil
    22 mins ago










  • Usually, I'd complain about requiring input validation, but, in this challenge, it's exactly what separates it from a normal "find the length" challenge.
    – Erik the Outgolfer
    22 mins ago












up vote
4
down vote

favorite
1









up vote
4
down vote

favorite
1






1





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


  • Standard loopholes are banned

  • Submission may be a full program or function

  • Input is guaranteed to only have 1 Vroom string

Scoring



This is code-golf, so the shortest code 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)










share|improve this 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


  • Standard loopholes are banned

  • Submission may be a full program or function

  • Input is guaranteed to only have 1 Vroom string

Scoring



This is code-golf, so the shortest code 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)







code-golf string decision-problem counting






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 42 mins ago

























asked 1 hour ago









FireCubez

3139




3139











  • Is raising an error on no Vroom acceptable? Alternatively, can I return a list with the speed and use the empty list for no Vroom?
    – Mnemonic
    1 hour ago










  • @Mnemonic Sure.
    – FireCubez
    1 hour ago










  • Suggest adding a testcase with uppercase r, o and/or m.
    – Shaggy
    43 mins ago










  • What's the correct output for Vrm!?
    – Neil
    22 mins ago










  • Usually, I'd complain about requiring input validation, but, in this challenge, it's exactly what separates it from a normal "find the length" challenge.
    – Erik the Outgolfer
    22 mins ago
















  • Is raising an error on no Vroom acceptable? Alternatively, can I return a list with the speed and use the empty list for no Vroom?
    – Mnemonic
    1 hour ago










  • @Mnemonic Sure.
    – FireCubez
    1 hour ago










  • Suggest adding a testcase with uppercase r, o and/or m.
    – Shaggy
    43 mins ago










  • What's the correct output for Vrm!?
    – Neil
    22 mins ago










  • Usually, I'd complain about requiring input validation, but, in this challenge, it's exactly what separates it from a normal "find the length" challenge.
    – Erik the Outgolfer
    22 mins ago















Is raising an error on no Vroom acceptable? Alternatively, can I return a list with the speed and use the empty list for no Vroom?
– Mnemonic
1 hour ago




Is raising an error on no Vroom acceptable? Alternatively, can I return a list with the speed and use the empty list for no Vroom?
– Mnemonic
1 hour ago












@Mnemonic Sure.
– FireCubez
1 hour ago




@Mnemonic Sure.
– FireCubez
1 hour ago












Suggest adding a testcase with uppercase r, o and/or m.
– Shaggy
43 mins ago




Suggest adding a testcase with uppercase r, o and/or m.
– Shaggy
43 mins ago












What's the correct output for Vrm!?
– Neil
22 mins ago




What's the correct output for Vrm!?
– Neil
22 mins ago












Usually, I'd complain about requiring input validation, but, in this challenge, it's exactly what separates it from a normal "find the length" challenge.
– Erik the Outgolfer
22 mins ago




Usually, I'd complain about requiring input validation, but, in this challenge, it's exactly what separates it from a normal "find the length" challenge.
– Erik the Outgolfer
22 mins ago










8 Answers
8






active

oldest

votes

















up vote
1
down vote














PowerShell, 83 bytes





($args-split"`n"|%if(($x=[regex]::Match($_,"^[Vv]ro*m!$")).success)$x).length-4


Try it online!



-splits the input $args on `newlines, 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.






share|improve this answer




















  • sls "^[Vv]ro*m!$"?
    – mazzy
    1 hour ago










  • @mazzy How would that work for multiline input? Your only input is one string, and so sls will give back ('','Vroom!','') for example.
    – AdmBorkBork
    57 mins ago










  • it's not completed solution. I mean, you can try sls instead [regex]::Match
    – mazzy
    54 mins ago










  • @mazzy Maybe you should post it as a separate solution.
    – AdmBorkBork
    50 mins ago

















up vote
1
down vote














SNOBOL4 (CSNOBOL4), 99 bytes



I	I =INPUT	:F(END)
I POS(0) ('V' | 'v') 'r' ARBNO('o') . X 'm!' RPOS(0) :F(I)
OUTPUT =SIZE(X)
END


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.



Outputs nothing if no Vroom! can bound found.






share|improve this answer






















  • Is all that whitespace necessary? Wow.
    – FireCubez
    1 hour ago






  • 1




    @FireCubez yep, that's what you get with a 50+ year-old language: weird whitespace requirements. It uses space/tab as concatenation and you must surround operators with whitespace as well.
    – Giuseppe
    1 hour ago

















up vote
1
down vote














sed 4.2.2, 20 bytes



-nr options required at the command-line.



s/^[Vv]r(o*)m!$/1/p


This outputs the speed in unary as the number of os.



Try it online!






share|improve this answer



























    up vote
    1
    down vote














    JavaScript (Node.js), 41 bytes





    a=>(l=/[Vv]r(o*)m!/.exec(a))&&l[1].length


    Try it online!






    share|improve this answer



























      up vote
      1
      down vote













      Powershell, 62 bytes





      if("$args"-cmatch'(?ms).*^[Vv]r(o*)m!$.*')$Matches[1].Length


      Explanation:




      • -cmatch means case-sensitive match;


      • (?ms) 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 single-line mode, where the period . matches every character (instead of every character except n)



      • $Matches[1] gives a group of o-sequence.

      Test script:



      $f = 

      if("$args"-cmatch'(?ms).*^[Vv]r(o*)m!$.*')$Matches[1].Length



      @(
      ,('Vrom!',1)
      ,('vrooooooom!',7)
      ,('Hello, Vroom!',$null)
      ,('Foo bar boo baz
      Vrooom!
      hi',3)
      ,('Vrm!ooo',$null)
      ,('PPCG puzzlers pie',$null)
      ,('hallo
      vROOOm!',$null)
      ,('
      Vrooom!
      Vrooooom!
      ',5) # undefined behavior. By default regexp is greedy, therefore last Vroom displayed.
      ,('vrm!',0) # :)
      ) | %
      $n,$expected = $_
      $result = &$f $n
      "$($result-eq$expected): $result"



      Output:



      True: 1
      True: 7
      True:
      True: 3
      True:
      True:
      True:
      True: 5
      True: 0





      share|improve this answer





























        up vote
        0
        down vote














        Stax, 16 bytes



        ü%.÷¶▌é⌂ü╥╪╛╪àG⌐


        Run and debug it






        share|improve this answer



























          up vote
          0
          down vote














          Retina, 21 bytes



          L$m`^[Vv]r(o*)m!$
          $.1


          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.






          share|improve this answer



























            up vote
            0
            down vote














            Japt, 21 bytes



            f"^[Vv]ro*m!$"'m mè'o


            Try it online!



            Explanation:



            f Get the substrings that match
            "^[Vv]ro*m!$" The provided RegEx
            'm in multiline mode
            mè'o Count the number of "o"





            share|improve this answer




















              Your Answer





              StackExchange.ifUsing("editor", function ()
              return StackExchange.using("mathjaxEditing", function ()
              StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
              StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
              );
              );
              , "mathjax-editing");

              StackExchange.ifUsing("editor", function ()
              StackExchange.using("externalEditor", function ()
              StackExchange.using("snippets", function ()
              StackExchange.snippets.init();
              );
              );
              , "code-snippets");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "200"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













               

              draft saved


              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f175120%2fhow-fast-am-i-vrooooming%23new-answer', 'question_page');

              );

              Post as a guest






























              8 Answers
              8






              active

              oldest

              votes








              8 Answers
              8






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              1
              down vote














              PowerShell, 83 bytes





              ($args-split"`n"|%if(($x=[regex]::Match($_,"^[Vv]ro*m!$")).success)$x).length-4


              Try it online!



              -splits the input $args on `newlines, 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.






              share|improve this answer




















              • sls "^[Vv]ro*m!$"?
                – mazzy
                1 hour ago










              • @mazzy How would that work for multiline input? Your only input is one string, and so sls will give back ('','Vroom!','') for example.
                – AdmBorkBork
                57 mins ago










              • it's not completed solution. I mean, you can try sls instead [regex]::Match
                – mazzy
                54 mins ago










              • @mazzy Maybe you should post it as a separate solution.
                – AdmBorkBork
                50 mins ago














              up vote
              1
              down vote














              PowerShell, 83 bytes





              ($args-split"`n"|%if(($x=[regex]::Match($_,"^[Vv]ro*m!$")).success)$x).length-4


              Try it online!



              -splits the input $args on `newlines, 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.






              share|improve this answer




















              • sls "^[Vv]ro*m!$"?
                – mazzy
                1 hour ago










              • @mazzy How would that work for multiline input? Your only input is one string, and so sls will give back ('','Vroom!','') for example.
                – AdmBorkBork
                57 mins ago










              • it's not completed solution. I mean, you can try sls instead [regex]::Match
                – mazzy
                54 mins ago










              • @mazzy Maybe you should post it as a separate solution.
                – AdmBorkBork
                50 mins ago












              up vote
              1
              down vote










              up vote
              1
              down vote










              PowerShell, 83 bytes





              ($args-split"`n"|%if(($x=[regex]::Match($_,"^[Vv]ro*m!$")).success)$x).length-4


              Try it online!



              -splits the input $args on `newlines, 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.






              share|improve this answer













              PowerShell, 83 bytes





              ($args-split"`n"|%if(($x=[regex]::Match($_,"^[Vv]ro*m!$")).success)$x).length-4


              Try it online!



              -splits the input $args on `newlines, 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.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered 1 hour ago









              AdmBorkBork

              25.2k361220




              25.2k361220











              • sls "^[Vv]ro*m!$"?
                – mazzy
                1 hour ago










              • @mazzy How would that work for multiline input? Your only input is one string, and so sls will give back ('','Vroom!','') for example.
                – AdmBorkBork
                57 mins ago










              • it's not completed solution. I mean, you can try sls instead [regex]::Match
                – mazzy
                54 mins ago










              • @mazzy Maybe you should post it as a separate solution.
                – AdmBorkBork
                50 mins ago
















              • sls "^[Vv]ro*m!$"?
                – mazzy
                1 hour ago










              • @mazzy How would that work for multiline input? Your only input is one string, and so sls will give back ('','Vroom!','') for example.
                – AdmBorkBork
                57 mins ago










              • it's not completed solution. I mean, you can try sls instead [regex]::Match
                – mazzy
                54 mins ago










              • @mazzy Maybe you should post it as a separate solution.
                – AdmBorkBork
                50 mins ago















              sls "^[Vv]ro*m!$"?
              – mazzy
              1 hour ago




              sls "^[Vv]ro*m!$"?
              – mazzy
              1 hour ago












              @mazzy How would that work for multiline input? Your only input is one string, and so sls will give back ('','Vroom!','') for example.
              – AdmBorkBork
              57 mins ago




              @mazzy How would that work for multiline input? Your only input is one string, and so sls will give back ('','Vroom!','') for example.
              – AdmBorkBork
              57 mins ago












              it's not completed solution. I mean, you can try sls instead [regex]::Match
              – mazzy
              54 mins ago




              it's not completed solution. I mean, you can try sls instead [regex]::Match
              – mazzy
              54 mins ago












              @mazzy Maybe you should post it as a separate solution.
              – AdmBorkBork
              50 mins ago




              @mazzy Maybe you should post it as a separate solution.
              – AdmBorkBork
              50 mins ago










              up vote
              1
              down vote














              SNOBOL4 (CSNOBOL4), 99 bytes



              I	I =INPUT	:F(END)
              I POS(0) ('V' | 'v') 'r' ARBNO('o') . X 'm!' RPOS(0) :F(I)
              OUTPUT =SIZE(X)
              END


              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.



              Outputs nothing if no Vroom! can bound found.






              share|improve this answer






















              • Is all that whitespace necessary? Wow.
                – FireCubez
                1 hour ago






              • 1




                @FireCubez yep, that's what you get with a 50+ year-old language: weird whitespace requirements. It uses space/tab as concatenation and you must surround operators with whitespace as well.
                – Giuseppe
                1 hour ago














              up vote
              1
              down vote














              SNOBOL4 (CSNOBOL4), 99 bytes



              I	I =INPUT	:F(END)
              I POS(0) ('V' | 'v') 'r' ARBNO('o') . X 'm!' RPOS(0) :F(I)
              OUTPUT =SIZE(X)
              END


              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.



              Outputs nothing if no Vroom! can bound found.






              share|improve this answer






















              • Is all that whitespace necessary? Wow.
                – FireCubez
                1 hour ago






              • 1




                @FireCubez yep, that's what you get with a 50+ year-old language: weird whitespace requirements. It uses space/tab as concatenation and you must surround operators with whitespace as well.
                – Giuseppe
                1 hour ago












              up vote
              1
              down vote










              up vote
              1
              down vote










              SNOBOL4 (CSNOBOL4), 99 bytes



              I	I =INPUT	:F(END)
              I POS(0) ('V' | 'v') 'r' ARBNO('o') . X 'm!' RPOS(0) :F(I)
              OUTPUT =SIZE(X)
              END


              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.



              Outputs nothing if no Vroom! can bound found.






              share|improve this answer















              SNOBOL4 (CSNOBOL4), 99 bytes



              I	I =INPUT	:F(END)
              I POS(0) ('V' | 'v') 'r' ARBNO('o') . X 'm!' RPOS(0) :F(I)
              OUTPUT =SIZE(X)
              END


              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.



              Outputs nothing if no Vroom! can bound found.







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited 1 hour ago

























              answered 1 hour ago









              Giuseppe

              15.7k31051




              15.7k31051











              • Is all that whitespace necessary? Wow.
                – FireCubez
                1 hour ago






              • 1




                @FireCubez yep, that's what you get with a 50+ year-old language: weird whitespace requirements. It uses space/tab as concatenation and you must surround operators with whitespace as well.
                – Giuseppe
                1 hour ago
















              • Is all that whitespace necessary? Wow.
                – FireCubez
                1 hour ago






              • 1




                @FireCubez yep, that's what you get with a 50+ year-old language: weird whitespace requirements. It uses space/tab as concatenation and you must surround operators with whitespace as well.
                – Giuseppe
                1 hour ago















              Is all that whitespace necessary? Wow.
              – FireCubez
              1 hour ago




              Is all that whitespace necessary? Wow.
              – FireCubez
              1 hour ago




              1




              1




              @FireCubez yep, that's what you get with a 50+ year-old language: weird whitespace requirements. It uses space/tab as concatenation and you must surround operators with whitespace as well.
              – Giuseppe
              1 hour ago




              @FireCubez yep, that's what you get with a 50+ year-old language: weird whitespace requirements. It uses space/tab as concatenation and you must surround operators with whitespace as well.
              – Giuseppe
              1 hour ago










              up vote
              1
              down vote














              sed 4.2.2, 20 bytes



              -nr options required at the command-line.



              s/^[Vv]r(o*)m!$/1/p


              This outputs the speed in unary as the number of os.



              Try it online!






              share|improve this answer
























                up vote
                1
                down vote














                sed 4.2.2, 20 bytes



                -nr options required at the command-line.



                s/^[Vv]r(o*)m!$/1/p


                This outputs the speed in unary as the number of os.



                Try it online!






                share|improve this answer






















                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote










                  sed 4.2.2, 20 bytes



                  -nr options required at the command-line.



                  s/^[Vv]r(o*)m!$/1/p


                  This outputs the speed in unary as the number of os.



                  Try it online!






                  share|improve this answer













                  sed 4.2.2, 20 bytes



                  -nr options required at the command-line.



                  s/^[Vv]r(o*)m!$/1/p


                  This outputs the speed in unary as the number of os.



                  Try it online!







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 44 mins ago









                  Digital Trauma

                  58.1k786220




                  58.1k786220




















                      up vote
                      1
                      down vote














                      JavaScript (Node.js), 41 bytes





                      a=>(l=/[Vv]r(o*)m!/.exec(a))&&l[1].length


                      Try it online!






                      share|improve this answer
























                        up vote
                        1
                        down vote














                        JavaScript (Node.js), 41 bytes





                        a=>(l=/[Vv]r(o*)m!/.exec(a))&&l[1].length


                        Try it online!






                        share|improve this answer






















                          up vote
                          1
                          down vote










                          up vote
                          1
                          down vote










                          JavaScript (Node.js), 41 bytes





                          a=>(l=/[Vv]r(o*)m!/.exec(a))&&l[1].length


                          Try it online!






                          share|improve this answer













                          JavaScript (Node.js), 41 bytes





                          a=>(l=/[Vv]r(o*)m!/.exec(a))&&l[1].length


                          Try it online!







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 28 mins ago









                          Luis felipe De jesus Munoz

                          3,51511049




                          3,51511049




















                              up vote
                              1
                              down vote













                              Powershell, 62 bytes





                              if("$args"-cmatch'(?ms).*^[Vv]r(o*)m!$.*')$Matches[1].Length


                              Explanation:




                              • -cmatch means case-sensitive match;


                              • (?ms) 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 single-line mode, where the period . matches every character (instead of every character except n)



                              • $Matches[1] gives a group of o-sequence.

                              Test script:



                              $f = 

                              if("$args"-cmatch'(?ms).*^[Vv]r(o*)m!$.*')$Matches[1].Length



                              @(
                              ,('Vrom!',1)
                              ,('vrooooooom!',7)
                              ,('Hello, Vroom!',$null)
                              ,('Foo bar boo baz
                              Vrooom!
                              hi',3)
                              ,('Vrm!ooo',$null)
                              ,('PPCG puzzlers pie',$null)
                              ,('hallo
                              vROOOm!',$null)
                              ,('
                              Vrooom!
                              Vrooooom!
                              ',5) # undefined behavior. By default regexp is greedy, therefore last Vroom displayed.
                              ,('vrm!',0) # :)
                              ) | %
                              $n,$expected = $_
                              $result = &$f $n
                              "$($result-eq$expected): $result"



                              Output:



                              True: 1
                              True: 7
                              True:
                              True: 3
                              True:
                              True:
                              True:
                              True: 5
                              True: 0





                              share|improve this answer


























                                up vote
                                1
                                down vote













                                Powershell, 62 bytes





                                if("$args"-cmatch'(?ms).*^[Vv]r(o*)m!$.*')$Matches[1].Length


                                Explanation:




                                • -cmatch means case-sensitive match;


                                • (?ms) 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 single-line mode, where the period . matches every character (instead of every character except n)



                                • $Matches[1] gives a group of o-sequence.

                                Test script:



                                $f = 

                                if("$args"-cmatch'(?ms).*^[Vv]r(o*)m!$.*')$Matches[1].Length



                                @(
                                ,('Vrom!',1)
                                ,('vrooooooom!',7)
                                ,('Hello, Vroom!',$null)
                                ,('Foo bar boo baz
                                Vrooom!
                                hi',3)
                                ,('Vrm!ooo',$null)
                                ,('PPCG puzzlers pie',$null)
                                ,('hallo
                                vROOOm!',$null)
                                ,('
                                Vrooom!
                                Vrooooom!
                                ',5) # undefined behavior. By default regexp is greedy, therefore last Vroom displayed.
                                ,('vrm!',0) # :)
                                ) | %
                                $n,$expected = $_
                                $result = &$f $n
                                "$($result-eq$expected): $result"



                                Output:



                                True: 1
                                True: 7
                                True:
                                True: 3
                                True:
                                True:
                                True:
                                True: 5
                                True: 0





                                share|improve this answer
























                                  up vote
                                  1
                                  down vote










                                  up vote
                                  1
                                  down vote









                                  Powershell, 62 bytes





                                  if("$args"-cmatch'(?ms).*^[Vv]r(o*)m!$.*')$Matches[1].Length


                                  Explanation:




                                  • -cmatch means case-sensitive match;


                                  • (?ms) 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 single-line mode, where the period . matches every character (instead of every character except n)



                                  • $Matches[1] gives a group of o-sequence.

                                  Test script:



                                  $f = 

                                  if("$args"-cmatch'(?ms).*^[Vv]r(o*)m!$.*')$Matches[1].Length



                                  @(
                                  ,('Vrom!',1)
                                  ,('vrooooooom!',7)
                                  ,('Hello, Vroom!',$null)
                                  ,('Foo bar boo baz
                                  Vrooom!
                                  hi',3)
                                  ,('Vrm!ooo',$null)
                                  ,('PPCG puzzlers pie',$null)
                                  ,('hallo
                                  vROOOm!',$null)
                                  ,('
                                  Vrooom!
                                  Vrooooom!
                                  ',5) # undefined behavior. By default regexp is greedy, therefore last Vroom displayed.
                                  ,('vrm!',0) # :)
                                  ) | %
                                  $n,$expected = $_
                                  $result = &$f $n
                                  "$($result-eq$expected): $result"



                                  Output:



                                  True: 1
                                  True: 7
                                  True:
                                  True: 3
                                  True:
                                  True:
                                  True:
                                  True: 5
                                  True: 0





                                  share|improve this answer














                                  Powershell, 62 bytes





                                  if("$args"-cmatch'(?ms).*^[Vv]r(o*)m!$.*')$Matches[1].Length


                                  Explanation:




                                  • -cmatch means case-sensitive match;


                                  • (?ms) 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 single-line mode, where the period . matches every character (instead of every character except n)



                                  • $Matches[1] gives a group of o-sequence.

                                  Test script:



                                  $f = 

                                  if("$args"-cmatch'(?ms).*^[Vv]r(o*)m!$.*')$Matches[1].Length



                                  @(
                                  ,('Vrom!',1)
                                  ,('vrooooooom!',7)
                                  ,('Hello, Vroom!',$null)
                                  ,('Foo bar boo baz
                                  Vrooom!
                                  hi',3)
                                  ,('Vrm!ooo',$null)
                                  ,('PPCG puzzlers pie',$null)
                                  ,('hallo
                                  vROOOm!',$null)
                                  ,('
                                  Vrooom!
                                  Vrooooom!
                                  ',5) # undefined behavior. By default regexp is greedy, therefore last Vroom displayed.
                                  ,('vrm!',0) # :)
                                  ) | %
                                  $n,$expected = $_
                                  $result = &$f $n
                                  "$($result-eq$expected): $result"



                                  Output:



                                  True: 1
                                  True: 7
                                  True:
                                  True: 3
                                  True:
                                  True:
                                  True:
                                  True: 5
                                  True: 0






                                  share|improve this answer














                                  share|improve this answer



                                  share|improve this answer








                                  edited 18 mins ago

























                                  answered 25 mins ago









                                  mazzy

                                  1,455312




                                  1,455312




















                                      up vote
                                      0
                                      down vote














                                      Stax, 16 bytes



                                      ü%.÷¶▌é⌂ü╥╪╛╪àG⌐


                                      Run and debug it






                                      share|improve this answer
























                                        up vote
                                        0
                                        down vote














                                        Stax, 16 bytes



                                        ü%.÷¶▌é⌂ü╥╪╛╪àG⌐


                                        Run and debug it






                                        share|improve this answer






















                                          up vote
                                          0
                                          down vote










                                          up vote
                                          0
                                          down vote










                                          Stax, 16 bytes



                                          ü%.÷¶▌é⌂ü╥╪╛╪àG⌐


                                          Run and debug it






                                          share|improve this answer













                                          Stax, 16 bytes



                                          ü%.÷¶▌é⌂ü╥╪╛╪àG⌐


                                          Run and debug it







                                          share|improve this answer












                                          share|improve this answer



                                          share|improve this answer










                                          answered 59 mins ago









                                          recursive

                                          4,7991221




                                          4,7991221




















                                              up vote
                                              0
                                              down vote














                                              Retina, 21 bytes



                                              L$m`^[Vv]r(o*)m!$
                                              $.1


                                              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.






                                              share|improve this answer
























                                                up vote
                                                0
                                                down vote














                                                Retina, 21 bytes



                                                L$m`^[Vv]r(o*)m!$
                                                $.1


                                                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.






                                                share|improve this answer






















                                                  up vote
                                                  0
                                                  down vote










                                                  up vote
                                                  0
                                                  down vote










                                                  Retina, 21 bytes



                                                  L$m`^[Vv]r(o*)m!$
                                                  $.1


                                                  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.






                                                  share|improve this answer













                                                  Retina, 21 bytes



                                                  L$m`^[Vv]r(o*)m!$
                                                  $.1


                                                  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.







                                                  share|improve this answer












                                                  share|improve this answer



                                                  share|improve this answer










                                                  answered 17 mins ago









                                                  Neil

                                                  77.2k744174




                                                  77.2k744174




















                                                      up vote
                                                      0
                                                      down vote














                                                      Japt, 21 bytes



                                                      f"^[Vv]ro*m!$"'m mè'o


                                                      Try it online!



                                                      Explanation:



                                                      f Get the substrings that match
                                                      "^[Vv]ro*m!$" The provided RegEx
                                                      'm in multiline mode
                                                      mè'o Count the number of "o"





                                                      share|improve this answer
























                                                        up vote
                                                        0
                                                        down vote














                                                        Japt, 21 bytes



                                                        f"^[Vv]ro*m!$"'m mè'o


                                                        Try it online!



                                                        Explanation:



                                                        f Get the substrings that match
                                                        "^[Vv]ro*m!$" The provided RegEx
                                                        'm in multiline mode
                                                        mè'o Count the number of "o"





                                                        share|improve this answer






















                                                          up vote
                                                          0
                                                          down vote










                                                          up vote
                                                          0
                                                          down vote










                                                          Japt, 21 bytes



                                                          f"^[Vv]ro*m!$"'m mè'o


                                                          Try it online!



                                                          Explanation:



                                                          f Get the substrings that match
                                                          "^[Vv]ro*m!$" The provided RegEx
                                                          'm in multiline mode
                                                          mè'o Count the number of "o"





                                                          share|improve this answer













                                                          Japt, 21 bytes



                                                          f"^[Vv]ro*m!$"'m mè'o


                                                          Try it online!



                                                          Explanation:



                                                          f Get the substrings that match
                                                          "^[Vv]ro*m!$" The provided RegEx
                                                          'm in multiline mode
                                                          mè'o Count the number of "o"






                                                          share|improve this answer












                                                          share|improve this answer



                                                          share|improve this answer










                                                          answered 15 mins ago









                                                          Kamil Drakari

                                                          2,401416




                                                          2,401416



























                                                               

                                                              draft saved


                                                              draft discarded















































                                                               


                                                              draft saved


                                                              draft discarded














                                                              StackExchange.ready(
                                                              function ()
                                                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f175120%2fhow-fast-am-i-vrooooming%23new-answer', 'question_page');

                                                              );

                                                              Post as a guest













































































                                                              Comments

                                                              Popular posts from this blog

                                                              Long meetings (6-7 hours a day): Being “babysat” by supervisor

                                                              Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

                                                              Confectionery