Skip to content

Commit

Permalink
fix regex
Browse files Browse the repository at this point in the history
  • Loading branch information
lunaruan committed May 3, 2022
1 parent 99eef9e commit 2adb16c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/react-devtools-shared/src/backend/utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/**
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down Expand Up @@ -188,7 +189,7 @@ export function formatWithStyles(
}

// Matches any of %(o|O|d|i|s|f), but not %%(o|O|d|i|s|f)
const REGEXP = /([^%]|^)(%([oOdisf]))/g;
const REGEXP = /([^%]|^)((%%)*)(%([oOdisf]))/g;
if (inputArgs[0].match(REGEXP)) {
return [`%c${inputArgs[0]}`, style, ...inputArgs.slice(1)];
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-devtools-shared/src/hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export function installHook(target: any): DevToolsHook | null {
}

// Matches any of %(o|O|d|i|s|f), but not %%(o|O|d|i|s|f)
const REGEXP = /([^%]|^)(%([oOdisf]))/g;
const REGEXP = /([^%]|^)((%%)*)(%([oOdisf]))/g;
if (inputArgs[0].match(REGEXP)) {
return [`%c${inputArgs[0]}`, style, ...inputArgs.slice(1)];
} else {
Expand Down

0 comments on commit 2adb16c

Please sign in to comment.