Skip to content

Escaping characters in loaded script from console #843

@gramian

Description

@gramian

ArcadeDB Version: v23.1.2 (build 9dbe3ce/1675373316135/main)

JDK Version: openjdk 11.0.18 2023-01-17

OS: MacOS 12.6

Escaping characters is done in the console terminal or studio commands with \, for example \\. When loading a script from console one needs \\\\ to escape \. For loading scripts the BufferedReader is used in the console (executeLoad): https://github.com/ArcadeData/arcadedb/blob/main/console/src/main/java/com/arcadedb/console/Console.java#L668 which I believe is the source of this different (and strange) behavior. The general issue is explained here, too: https://coderanch.com/t/277390/java/reading-file-BufferedReader .

Expected behavior

Same behavior as in console (keyboard input) or studio.

Actual behavior

Escaped characters need extra escape slashes

Steps to reproduce

This works from console or studio, but not from script:

CREATE DOCUMENT TYPE doc;
CREATE PROPERTY doc.uri STRING (regexp '^([a-zA-Z]{1,15}:)(\\/\\/)?[^\\s\\/$.?#].[^\\s]*$');

This works when loading from a script:

CREATE DOCUMENT TYPE doc;
CREATE PROPERTY doc.uri STRING (regexp '^([a-zA-Z]{1,15}:)(\\\\/\\\\/)?[^\\\\s\\\\/$.?#].[^\\\\s]*$');

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions