Skip to content

Commit dcbaa80

Browse files
committed
Replace $ with _ in variable names
1 parent dc6a7c8 commit dcbaa80

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

packages/utils/src/DbNameValidator.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const TABLE_PREFIX = 'table_';
44
const COLUMN_PREFIX = 'column_';
55

66
const VALID_TABLE_NAMES = ['$+@abc-123_ABC', '$'];
7-
const VARIABLE_NAMES_FROM_VALID = ['$__abc_123_ABC', '$'];
7+
const VARIABLE_NAMES_FROM_VALID = ['___abc_123_ABC', '_'];
88

99
const INVALID_TABLE_NAMES = ['%^&ab-c', '-a_b c', '-', '0', '%', ''];
1010
const LEGALIZED_INVALID_TABLE_NAMES = [

packages/utils/src/DbNameValidator.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const JAVA_KEYWORDS = new Set([
6464

6565
// The '$' character is not valid in Deephaven table and column names,
6666
// yet it is treated as valid in the DbNameValidator Java class.
67-
// TODO: Update the regexes once DH-19169 is merged.
67+
// TODO: Update the regexes once (or if) DH-19169 is merged.
6868

6969
// From io.deephaven.db.tables.utils.DBNameValidator#STERILE_TABLE_AND_NAMESPACE_REGEX
7070
const STERILE_TABLE_AND_NAMESPACE_REGEX = /[^a-zA-Z0-9_$\-+@]/g;
@@ -75,7 +75,7 @@ const STERILE_COLUMN_AND_QUERY_REGEX = /[^A-Za-z0-9_$]/g;
7575
// From io.deephaven.db.tables.utils.DBNameValidator#TABLE_NAME_PATTERN
7676
const TABLE_NAME_PATTERN = /^[a-zA-Z_$][a-zA-Z0-9_$\-+@]*$/;
7777

78-
const STERILE_VARIABLE_NAME_REGEX = /[^a-zA-Z0-9_$]/g;
78+
const STERILE_VARIABLE_NAME_REGEX = /[^a-zA-Z0-9_]/g;
7979

8080
function columnNameReplacer(input: string): string {
8181
// Replace all dashes and spaces with underscores
@@ -147,7 +147,7 @@ class DbNameValidator {
147147
);
148148

149149
/**
150-
* Get a variable name based on the passed in string.
150+
* Make a valid variable name based on the passed in string.
151151
* @param name The name to get the variable name for
152152
* @returns Variable name
153153
*/

0 commit comments

Comments
 (0)