[JS CS3] RegExp Object containing only one backslash (how to escape)

Hi
I'm trying to escape one backslash in my RegExp Object, but I get a Syntax Error:
     myObj = new RegExp ( "\\" );
I tried it phyton Style   myObj = new RegExp ( "\\\\" ); but that's not working right.
Thanks for any hint.
Stefan

Stefan,
First of all, in your sample text you need to escape your backslash as well:
myText = "This is an \\ of search and replace.";
You can see this in these examples:
alert ("a\rb") prints "a" then "b" on a new line; alert ("a\\rb") prints "a\rb".
Another problem is that you use a regex as the replacement object (myWhit), but that should be a string. With these two things corrected, it works fine:
function main()
     var myText = "This is an \\ of search and replace.";
     var myWhat = new RegExp ( "\\\\" );
     var myWhatSearch = new RegExp ( "\\\\" );
     var myWhit = "example";
     alert( myReplaceExample( myText, myWhatSearch, myWhat, myWhit) );
     return true;
That new RegExp ("\\") can't be correct can be seen if you start with a literal regex, in which you would use an escaped backslash:
myText = myText.replace (/\\/, "example")
To use \\ in a new RegExp () construction, you need to place it in a string, and you need to escape both backslashes, so you end up with "\\\\".
Peter

Similar Messages

  • How do I display AS3 Object in only one state?

    I created a AS3 object from a SWFLoader class as an animation, which I then place in a Flex stage.  I need to display the object programmatically in only one state but there is no "includeIn()" method to include it in just one state.
    Right now, it is showing up on all of the flex states.  I add this object at different times and positions in the state.  Everything is fine except it displays in all the states.
    How do I display a AS3 object in only one state?
    Thank you.

    When i use visible property as you suggested, it works, but only on one object.  I am generating more than one of these objects, so there could be 3 or 4, etc of these objects displaying concurrently at different x y positions in the state.
    Is there a way to grab all of the objects created by this AS3 class at once and apply the visible property?
    thanx

  • I have 2 accounts & need only one.  How do I cancel one or merge them?  Thanks

    I have 2 itune accounts and need only one.  How do I cancel one or merge them?  Thanks

    You cannot merge them.
    All purchases will always be tied to the account from which they were purchased.
    You can simply stop using one of them.

  • Directly launch the object if only one result is found (SEARCH_AUTONAV )

    Hi All
    We are on CRM 7.0 EP1, and I read an article in CRMEXPERT  that one of the improvements in CRM 7.0  would be to jump to the object directly if only one result is found. For example, if I know the sales order number I can open it directly by putting the SO number in search field 'Sales Order' and instead of giving me the result list, the system will directly open the sales order.
    The parameter to used for this is SEARCH_AUTONAV in function profile.But when I test this it is not working.I did not found any documentation about this parameter on help.sap or internet.
    Any idea about this parameter and how to use it?
    Or is there anyway to achieve what I am looking for?
    Thanks in advance for your help
    Swapnil

    Hello Swapnil,
    I'm not sure that SEARCH_AUTONAV is a desired parameter. But there is an improvement request which SAP has introduced by the [Note 1602520 - Improvement requests: Central Edit Button, One hit display|https://service.sap.com/sap/support/notes/1602520].
    Also for tehcnical basis please refer to [Note 1548131 - CC1: Automatic navigation to search result (technical basis)|https://service.sap.com/sap/support/notes/1548131].
    In general it's all about ONE_HIT_DIRECT_DISPL parameter.

  • Content canvas is not displaying . It contain only one control block .

    Hi ,
    In my form , i have only one control block . in this block i have one display item. I have specified canvas for this item as "CANVAS4".
    I have created "canvas4" . and i have adjusted display item position in canvas. In this case while running form , it is not displaying my content canvas.
    Canvas is disappearing .
    Can any one please help me .
    Thanks in advance ,
    Sanjeev.

    Please take a look at: http://blogs.oracle.com/shay/entry/10_commandments_for_the_otn_fo
    In order for anyone to offer valuable feedback, we ALWAYS need to know what product versions you are using, which Operating Systems are involved, client side information (browser, jre, os, etc), and if an error is involved, what are the details of the error.
    Craig...

  • Is point in custom object with only one control handle possible?

    I notice with a rounded rectangle if you make it editable and click on any of the points, they all seem to have only one "control handle". Normally there are always two. Is there really only one control handle on those points, or does it just look that way? Assuming there is indeed only one control handle, how can I do that too?

    Chris Miner wrote:
    I notice with a rounded rectangle if you make it editable and click on any of the points, they all seem to have only one "control handle". Normally there are always two. Is there really only one control handle on those points, or does it just look that way?
    Hi Chris,
    Yes, there really is only one control handle for these points. And a look at the 'ordinary' rectangle shows that the control points at its vertices have zero control handles.
    The rectangles appear to be set to retain the property of the rounded corner attaching to a line segment (for the rounded rectangle) or the vertex being formed by the intersection of two lines (for the 'ordinary' rectangle).
    "Normal" control points (your term) treat the point at which they are inserted as a point on a curve, even it that curve has infinite radius (and appears as a line segment), and provide for revision of the curve on both sides of the control.
    If you insert one of these (option-click) anywhere on the shape, it will appear as an unfilled red circle, and will have two control handles.
    Assuming there is indeed only one control handle, how can I do that too?
    For a start, you could explain what you mean by "do that too."
    Regards,
    Barry

  • CS3: Table on more than one page - How can I get the UIDRef's of the pages?

    Hi
    I have a table over more than one page. How can I get all UIDRef's of the pages who contain parts of the table?
    Thanks
    Hans

    Hi
    Thanks for the answer.
    - How can I get all page items of a table?
    - One other question: If I have a table over two pages (side by side) there is only one page item of the table. Right? How can I get the two pages (UIDRef) in that case?
    Thanks
    Hans

  • Interactive forms- i see only one record -how can i see more?

    Hi experts,
    i have a table and the result is only one record instead of more records.
    how can i see more records?
    my code is:
    types: begin of structure_0021,
    favor type pa0021-favor,
    yy_id type pa0021-yy_id,
    fgbdt type pa0021-fgbdt,
    end of structure_0021.
    data: it_0021 type table of struct_0021,
             wa_0021 like line of it_0021.
    select favor yy_id fgbdt from pa0021 into corresponding fields of table it_0021
    where pernr = lv_pernr and
    subty = '2'.
    data: lo_nd_adobe2 type ref to if_wd_context_node,
            lo_nd_ls00212 type ref to if_wd_context_node,
            lo_el_ls00212 type ref to if_wd_context_element,
           ls_ls00212 type wd_this->element_ls0021.
    lo_nd_adobe2 = wd_context->get_child_node( name = wd_this->wdctx_adobe).
    lo_el_ls00212 = lo_nd_adobe2->get_element().
    lo_nd_ls00212 = lo_nd_adobe->get_child_node(name = wd_this->wdctx_ls0021).
    lo_el_ls00212 = lo_nd_ls00212->get_element().
    loop at it_0021 into wa_0021.
    lo_el_ls00212->get_static_attributes(importing static_attributes = ls_ls00212).
    endloop.
    lo_nd_ls00212->bind_table(new_items = it_0021).
    if anyone can help me - i will really appreciate it.
    i tried other thing and didnt succeed.
    thanks,
    Michal.

    Obvious question, but have you got 'Find My iPhone' set on both devices?  Settings>iCloud>Find My iPhone.

  • HT1386 I have been syncing my IPad to only one PC computer successfully for over a year.  Now when I try to sync I get the message that the ipad is synced with another computer and can be synced with only one.  How can I correct this?

    Although I have synced my ipad to only one PC computer I now get the message that it is synced to another computer and only one computer sync is permitted.  I have lots of apps on the ipad and do not want to loose everything by starting fresh with the ipad.  How can I get the ipad to again accept my computer and sync successfully?

    Plawexki wrote:
    ...  do you know if the contacts, photos, messages etc will be wiped?
    Yes... Everything will be Wiped and Replaced with what is currently on Your Mac.
    SYNCING with iTunes
    See here  >  http://support.apple.com/kb/HT1386
    From Here  >  http://www.apple.com/support/iphone/syncing/
    You may find this information of interest...
    Have a read here...
    https://discussions.apple.com/message/18409815?ac_cid=ha
    And See Here...
    How to Use Multiple iDevices with One Computer

  • I'm on a network with 2 printers and want to uninstall only one.  How do I do it?

    I recently added a Lexmark E260dn printer to my network (still want to have my HP 8550 connected).
    The printer was faulty so took it back, but want to install another one.  How do I "uninstall" just the old info for the Lexmark without losing my HP info?

    For username and password, you need to use the username and password for someone that has an administrator account. If you have an admin type account, then just use your username (the short one, which is the name of your home directory) and password.
    If not, you need the username and password of someone that does have an admin type account on your computer.
    It need not have any relationship to any account used to set up the system or any software on it.
    If you can do software updates using your name and password, then you are an admin user. Use your username (the short one, not your full name) and your password.
    You can get your short username in Terminal:
    echo $LOGNAME

  • Place object on only one page

    Hi,
    when I place an object onto a page, for example a Photo page, it shows up on both the main page and also on the second page of the template. How can I make it page specific? In other words, only show up on one of the two pages of the template.
    To clarify ... the Photos template has placeholders for photos. When you click a photo, you are taken to another page, where the photos can be seen larger. An object that I place on one of these two pages, shows up on both and yet the template's own elements don't.
    Any help, much appreciated.
    Grant

    This is the function of the "photos" template - to have a page of thumbnails and a page where you "view" the individual photos larger or in a slideshow.
    If you don't want this feature drop your photos onto a "blank" page rather than a "photos" page.

  • Returning two rows with one column containing only one place

    Dear all;
    I have a query that returns two rows similar to this below
    ID      PLACE            PROGRAM
    A       NEWYORK      PROGRAM A
    A       NEWYORK      PROGRAM B
    I would like this instead
    ID      PLACE             PROGRAM
    A       NEWYORK       PROGRAM A
                                   PROGRAM  B
    All help is appreciated. Thank you.Edited by: user13328581 on Mar 22, 2011 11:52 AM

    user13328581 wrote:
    WOW...THanks a lot Solomon, I have never used partitions and row_number in such a manner...can you please explain your logic.Sure:
    row_number() over(partition by id order by place,program)This will take all rows returned by the query andsplit them into buckets (partitions) by id. Inside each bucket it will order rows by place and program and assign them row numbers. So for each ID row number 1 will be row with first (alphabetically) place first programt. And this is the row where we want ID to show up. That is why we wrap the above analytic function in CASE statement which will do exactly that. Now:
    row_number() over(partition by id,place order by program)does pretty much the same just bucket is ID and PLACE combination. So for each such combination we want to show only for the first (alphabetically) programt.
    Now notice in ORDER BY clause I prefix ID and PLACE with table alias. You must do it since otherwise query alias ID and PLACE will take precedence resulting in wrong sort order (remember we nulled all ID and PLACE except for row number 1).
    SY.

  • Console.app - All Messages contains only one day

    Hi everyone,
    My problem is the following: When I start Console.app the range of Messages displayed is: 2013-03-13 14:29:10 to 2013-03-13 22:24:07. So there are 4000 Entries from last month from exactly one day. All other logs are working perfectly the way they schuld but this one seems to be messed up.
    What can I do to fix this?

    Did some more "research": I just ran "syslog" in terminal.
    This is the last message:
    Mar 19 22:24:03 Martins-MacBook-Pro.local iTunes[471] <Notice>: 2013-03-19 10:24:03.917460 PM [AVSystemController] Stopping AirPlay
    So it looks like syslog is causing the problem because Cosole.app is taking it's data from there....

  • I have multiple apple ids. I want only one. How can I do this?

    I live in two countries and can't download anything as it seems I am always in the wrong country.... This is complicated by my having multiple apple ids. When trying to reduce this to one, I lost all my previously bought apps. Never mind. However it seems that I have not yet achieved this..... And now to boot I am unable to buy anymore apps as I appear to always be on the wrong country. How can this be?
    As I have spent MANY hours on this, I am happy to start again, and if I continue to fail, I think I will leave apple for good.
    Any patient soul willing to help?

    Hello,
         What two countries are you living in? Are certain apps you have downloaded in one country not available in the other? The only solution I can see is to start new with a new apple ID or you can use one of e two you currently have. What do you mean "And now to boot I am unable to buy anymore apps as I appear to always be on the wrong country." This could be a problem with the firmware in which a restore may be necessary. Let me know if you have any questions and good luck. Don't forget to click this helped me or solved my question if this helped you. Thanks

  • HT4098 i paid 14.99 usd for one month but i get only one month how can i acces again

    hai
    ipaid for yalo 14.99usd thats for one month unlimited freecall but now only 10 days my account is suspended
    why my account has suspended?

    We are fellow users here on these user-to-user forums, you're not talking to iTunes Support nor Apple, we won't know.
    Do you mean that you iTunes account is disabled ? If you do then you might be able to re-enable it via this page : http://appleid.apple.com, then 'reset your password'.  You might then need to log out and back into your account on your phone.
    Or that your account with that app is 'suspended' ? If you do then have you contacted the app's developer ?

Maybe you are looking for