![]() ![]() Starting with Gecko 39 (Firefox 39 / Thunderbird 39 / SeaMonkey 2.36), the non-standard flags argument is deprecated and throws a console warning ( bug 1142351).This is fixed now 'a'.search() and 'a'.search(undefined) correctly return 0. Prior to Gecko 8.0, search() was implemented incorrectly when it was called with no parameters or with undefined, it would match against the string 'undefined', instead of matching against the empty string.flags was a non standard second argument only available in Gecko : str.search( regexp, flags).Legend Full support Full support No support No support Non-standard. If you'd like to contribute to the data, please check out and send us a pull request. The compatibility table in this page is generated from structured data. Implemented in JavaScript 1.2.ĮCMAScript 5.1 (ECMA-262) The definition of '' in that specification.ĮCMAScript 2015 (6th Edition, ECMA-262) The definition of '' in that specification.ĮCMAScript Latest Draft (ECMA-262) The definition of '' in that specification. an unsuccessful search (-1) Specifications Specification The following example searches a string with 2 different regex objects to show a successful search (positive value) vs. When you want to know whether a pattern is found and also its index in a string use search() (if you only want to know if it exists, use the similar test() method on the RegExp prototype, which returns a boolean) for more information (but slower execution) use match() (similar to the regular expression exec() method). The index of the first match between the regular expression and the given string if not found, -1. If a non-RegExp object obj is passed, it is implicitly converted to a RegExp by using new RegExp(obj). Syntax str.search( regexp) Parameters regexp A regular expression object. ![]() If you'd like to contribute to the interactive examples project, please clone and send us a pull request. The source for this interactive example is stored in a GitHub repository. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |