- From: Ruben Verborgh <ruben.verborgh@ugent.be>
- Date: Mon, 11 Aug 2014 22:37:58 +0200
- To: Markus Lanthaler <markus.lanthaler@gmx.net>
- Cc: public-hydra@w3.org
> A *simple* regex should be enough for parsing. At the moment, such a regex would look like this: /^"(.*)"(?:\^\^(.+)|@(.+))?$/ The first group captures the literal value, the second group the type, the third group the language. A non-match means the entity is a literal. var literalRegex = /^"(.*)"(?:\^\^(.+)|@(.+))?$/ literalRegex.exec('http//example.org'); // null literalRegex.exec('""'); // ['""', '', undefined, undefined] literalRegex.exec('"abc"'); // ['"abc"', 'abc', undefined, undefined] literalRegex.exec('"abc"@en'); // ['"abc"@en', 'abc', undefined, 'en'] literalRegex.exec('"abc"^^http://example.org/#type'); // ['"abc"^^http://example.org/#type', 'abc', 'http://example.org/#type', undefined] Best, Ruben
Received on Monday, 11 August 2014 20:38:33 UTC