Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-818

Regular expression with case insensitive modifer (/i) behaves strangely

    Details

      Description

      {html}<div><p>It's not simply being ignored. It seems that expressions with an
      even number of characters work correctly, while those with an odd
      length fail to match. Without the /i modifier, all tested
      expressions have been correct.<br></p>
      <pre>
      <code class="javascript">var mystring = 'Add to Address Book';
      // with /i modifier
      Ti.API.info(mystring.search(/s/i)); // -1 (incorrect) (string length: odd)
      Ti.API.info(mystring.search(/ss/i)); // 12 (correct) (string length: even)
      Ti.API.info(mystring.search(/ess/i)); // -1 (incorrect) (string length: odd)
      Ti.API.info(mystring.search(/ress/i)); // 10 (correct) (string length: even)
      Ti.API.info(mystring.search(/dress/i)); // -1 (incorrect) (string length: odd)
      Ti.API.info(mystring.search(/ddress/i)); // 8 (correct) (string length: even)
      Ti.API.info(mystring.search(/address/i)); // -1 (incorrect) (string length: odd)
      Ti.API.info(mystring.search(/address /i)); // 7 (correct) (string length: even)
      // no modifier
      Ti.API.info(mystring.search(/address/)); // -1 (correct) (both cases correct here)
      Ti.API.info(mystring.search(/ddress/)); // 8 (correct)</code>
      </pre></div>{html}

        Attachments

          Activity

            People

            • Assignee:
              rseagraves Reggie Seagraves
              Reporter:
              nickwing Nick Wing
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-786
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code