Skip to content

Commit

Permalink
check for matching attribute quote pairs in regexp - fixes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
dbushell committed Mar 12, 2024
1 parent 0d27d0e commit af60497
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dbushell/xml-streamify",
"version": "0.3.0",
"version": "0.4.0",
"exports": {
".": "./mod.ts",
"./node": "./src/node.ts",
Expand Down
4 changes: 2 additions & 2 deletions src/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ export class Node {
// Setup and parse attributes on first access
this.#attr = {};
if (this.raw) {
const regex = /([\w:.-]+)\s*=\s*["'](.*?)["']/g;
const regex = /([\w:.-]+)\s*=\s*(["'])(.*?)\2/g;
let match: RegExpExecArray | null;
while ((match = regex.exec(this.raw)) !== null) {
this.#attr[match[1]] = match[2];
this.#attr[match[1]] = match[3];
}
}
return this.#attr;
Expand Down

0 comments on commit af60497

Please sign in to comment.