KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Are there any discernable performance differences between using str.indexOf("src") and str.match(/src/) I personally prefer match (and regexp) but colleagues seem to go the other way. We were wondering if it mattered ...? EDIT: I should have said at the outset that this is for functions that will be doing partial plain-string matching (to pick up identifiers in class attributes for JQuery) rather than full regexp searches with wildcards etc. class='redBorder DisablesGuiClass-2345-2d73-83hf-8293' So it's the difference between: string.indexOf('DisablesGuiClass-'); and string.match(/DisablesGuiClass-/)
Tags (comma-separated)
Save Edits
Cancel