未验证 提交 ee0366dd 编写于 作者: R rsercano

fixes #503

上级 396bce43
......@@ -35,7 +35,7 @@ const replaceShellStuff = function (str, regex, extendedJsonVersion) {
};
const replaceRegex = function (str) {
const regex = /:\/.*?([^\\]\/.*?(,|}|]))+/gim;
const regex = /:\/[^\/].*?([^\\]\/.*?(,|}|]))+/gim;
const matches = str.match(regex);
if (matches) {
......
......@@ -38,6 +38,17 @@ describe('ExtendedJSON', () => {
expect(convertedJson).to.eql({ a: true, b: 123, c: { $regex: '^/d', $options: 'xmi' } });
});
it('no regex & http', () => {
// prepare
const str = '{"a":true,"b":123,"c":"[{\\"test\\":\\"http://google.com//\\"}]"}';
// execute
const convertedJson = ExtendedJSON.convertAndCheckJSON(str);
// verify
expect(convertedJson).to.eql({ a: true, b: 123, c: '[{"test":"http://google.com//"}]' });
});
it('simple regex with $regex without string & $options', () => {
// prepare
const str = '{a: true, b: 123, c: {$regex:/asd^!,=}/, $options: "xmi"}}';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册