CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266

    Searching for "+" using JScript

    Is it possible to search for a "+" using the search function in JScript? I am getting ther error message "Unexpected Quatifier" when I try to. So I have this little snippet that shows the problem. The search for an "o" works but the next search does not. I have also used "\+" and that does not work. There is probably a different way to escape the "+" but the documentation seems to not specify it.
    Code:
    var WshShell = WScript.CreateObject("WScript.Shell");
    var sValue = "one+two+three";
    WshShell.Popup(sValue.search("o"));
    WshShell.Popup(sValue.search("\x2B"));
    Something that is confusing is that replace works, as in:
    Code:
    sValue = sValue.replace("\x2B", " ");
    except replace only replaces the first occcurence; search is useful for determining if there are more.
    Last edited by Sam Hobbs; May 21st, 2002 at 05:37 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured