Skip to content

Commit 7169cd8

Browse files
authored
enh(bash) $pattern: allow numbers after the first character (#3494)
* Update the pattern regex for the bash language Fixes: #3489 ((bash) keywords with numbers are not recognized) With the new regex, also numbers INSIDE the pattern is allowed. Before, `a2enmod` would not have been recognized. Now it gets properly recognized. For the details of the test results see: #3489 (comment)
1 parent fd30701 commit 7169cd8

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ New Grammars:
1010

1111
Grammars:
1212

13+
- enh(bash) improved keyword `$pattern` (numbers allowed in command names) [Martin Mattel][]
1314
- fix(markdown) Handle `***Hello world***` without breaking [Josh Goebel][]
1415
- enh(php) add support for PHP Attributes [Wojciech Kania][]
1516
- fix(java) prevent false positive variable init on `else` [Josh Goebel][]
@@ -22,7 +23,7 @@ Grammars:
2223
- enh(elixir) recognize references to modules [Mark Ericksen][]
2324
- enh(css): add support for more properties [Nicolaos Skimas][]
2425

25-
26+
[Martin Mattel]: https://github.com/mmattel
2627
[John Foster]: https://github.com/jf990
2728
[Wojciech Kania]: https://github.com/wkania
2829
[Melissa Geels]: https://github.com/codecat

src/languages/bash.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ export default function(hljs) {
355355
name: 'Bash',
356356
aliases: [ 'sh' ],
357357
keywords: {
358-
$pattern: /\b[a-z._-]+\b/,
358+
$pattern: /\b[a-z][a-z0-9._-]+\b/,
359359
keyword: KEYWORDS,
360360
literal: LITERALS,
361361
built_in: [

0 commit comments

Comments
 (0)