Skip to content

Commit d590e39

Browse files
authored
Merge pull request #20157 from Homebrew/shebang-regex
language/*: fix `*_SHEBANG_REGEX` anchors
2 parents cfede01 + 6a7416c commit d590e39

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

Library/Homebrew/language/node.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ module Shebang
9696
module_function
9797

9898
# A regex to match potential shebang permutations.
99-
NODE_SHEBANG_REGEX = %r{^#! ?(?:/usr/bin/(?:env )?)?node( |$)}
99+
NODE_SHEBANG_REGEX = %r{\A#! ?(?:/usr/bin/(?:env )?)?node( |$)}
100100

101101
# The length of the longest shebang matching `SHEBANG_REGEX`.
102102
NODE_SHEBANG_MAX_LENGTH = T.let("#! /usr/bin/env node ".length, Integer)

Library/Homebrew/language/perl.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module Shebang
1515
module_function
1616

1717
# A regex to match potential shebang permutations.
18-
PERL_SHEBANG_REGEX = %r{^#! ?(?:/usr/bin/(?:env )?)?perl( |$)}
18+
PERL_SHEBANG_REGEX = %r{\A#! ?(?:/usr/bin/(?:env )?)?perl( |$)}
1919

2020
# The length of the longest shebang matching `SHEBANG_REGEX`.
2121
PERL_SHEBANG_MAX_LENGTH = T.let("#! /usr/bin/env perl ".length, Integer)

Library/Homebrew/language/php.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module Shebang
1515
module_function
1616

1717
# A regex to match potential shebang permutations.
18-
PHP_SHEBANG_REGEX = %r{^#! ?(?:/usr/bin/(?:env )?)?php( |$)}
18+
PHP_SHEBANG_REGEX = %r{\A#! ?(?:/usr/bin/(?:env )?)?php( |$)}
1919

2020
# The length of the longest shebang matching `SHEBANG_REGEX`.
2121
PHP_SHEBANG_MAX_LENGTH = T.let("#! /usr/bin/env php ".length, Integer)

Library/Homebrew/language/python.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ module Shebang
112112
module_function
113113

114114
# A regex to match potential shebang permutations.
115-
PYTHON_SHEBANG_REGEX = %r{^#! ?(?:/usr/bin/(?:env )?)?python(?:[23](?:\.\d{1,2})?)?( |$)}
115+
PYTHON_SHEBANG_REGEX = %r{\A#! ?(?:/usr/bin/(?:env )?)?python(?:[23](?:\.\d{1,2})?)?( |$)}
116116

117117
# The length of the longest shebang matching `SHEBANG_REGEX`.
118118
PYTHON_SHEBANG_MAX_LENGTH = T.let("#! /usr/bin/env pythonx.yyy ".length, Integer)

0 commit comments

Comments
 (0)