{ "id": "61450", "key": "TIMOB-818", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:54:20.000+0000", "created": "2011-04-15T02:37:07.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "expression", "javascript", "match", "mobilesdk", "regex", "regular", "search" ], "versions": [], "issuelinks": [], "assignee": { "name": "rseagraves", "key": "rseagraves", "displayName": "Reggie Seagraves", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:54:20.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}

It's not simply being ignored. It seems that expressions with an\neven number of characters work correctly, while those with an odd\nlength fail to match. Without the /i modifier, all tested\nexpressions have been correct.

\n
\nvar mystring = 'Add to Address Book';\n// with /i modifier\nTi.API.info(mystring.search(/s/i)); // -1 (incorrect) (string length: odd)\nTi.API.info(mystring.search(/ss/i)); // 12 (correct) (string length: even)\nTi.API.info(mystring.search(/ess/i)); // -1 (incorrect) (string length: odd)\nTi.API.info(mystring.search(/ress/i)); // 10 (correct) (string length: even)\nTi.API.info(mystring.search(/dress/i)); // -1 (incorrect) (string length: odd)\nTi.API.info(mystring.search(/ddress/i)); // 8 (correct) (string length: even)\nTi.API.info(mystring.search(/address/i)); // -1 (incorrect) (string length: odd)\nTi.API.info(mystring.search(/address /i)); // 7 (correct) (string length: even)\n// no modifier\nTi.API.info(mystring.search(/address/)); // -1 (correct) (both cases correct here)\nTi.API.info(mystring.search(/ddress/)); // 8 (correct)\n
{html}", "attachment": [], "flagged": false, "summary": "Regular expression with case insensitive modifer (/i) behaves strangely", "creator": { "name": "nickwing", "key": "nickwing", "displayName": "Nick Wing", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "nickwing", "key": "nickwing", "displayName": "Nick Wing", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "124126", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Was actually a duplicate of another bug (with the same sample\ncode!) at some point. I remember fixing it.

\n

Tested against 1.6.0 RC1, confirmed.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:37:08.000+0000", "updated": "2011-04-15T02:37:08.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }