Skip to content

Commit 8fce932

Browse files
committed
Fix regex expression
1 parent 9a74dcd commit 8fce932

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Source/Scene/ModelUtility.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,12 @@ define([
167167
}
168168
};
169169

170-
function regexIndexOf(text, regex, i) {
171-
var indexInSuffix = text.slice(i).search(regex);
172-
return indexInSuffix < 0 ? indexInSuffix : indexInSuffix + i;
173-
}
174-
175170
function replaceAllButFirstInString(string, find, replace) {
176171
// Limit search to strings that are not a subset of other tokens.
177-
find += '(?![a-zA-Z_$])';
172+
find += '(?![a-zA-Z0-9_])';
178173
find = new RegExp(find, 'g');
179174

180-
var index = regexIndexOf(string, find, 0);
175+
var index = string.search(find);
181176
return string.replace(find, function(match, offset) {
182177
return index === offset ? match : replace;
183178
});

0 commit comments

Comments
 (0)