HOW TO REPLACE  THIS

Hi
Form
Can somebody Tell me where am i doing Wrong
if(WordPlus.startsWith("+~")) {
WordPlus = WordPlus .replaceAll( "+~" , "+" );
At run time the Execption is produced
java.util.regex.PatternSyntaxException: Dangling meta character '+' near index 0
thx in advance

Hi
Form
I Used the StringBuffer Replace ment Factor something like this
as u advised but something turns up wrong in the 3rd and 4th if Condition
The code is as below
public string getReplace( String Word){
String WordPlus = "",WordMinus = "";
if(Word.startsWith("+~"){
StringBuffer splus = new StringBuffer(Word);
WordPlus = (splus.delete(0,2)+"")+trim();
if(Word.startsWith("-~"){
StringBuffer sminus = new StringBuffer(Word);
WordMinus = (sminus .delete(0,2)+"")+trim();
if(Word.startsWith("+"){
if(Word.startsWith("-"){
Word = "+" + WordPlus + "-" + WordMinus ;
return Word;
It the I/p is "+~Roses~"
O/p is "+Roses~"
but if I/p is "+Roses~
O/p does not Reply any thing.
Please Help me
thx in advace

Similar Messages

  • How to replace this code!!!!????? please Help!!!!!!!!!!!

    How I can replace following code as getServlet method is deprecated.
    getServletContext().getServlet("trapenv");

    this is Authenticator.java
    package trap.content;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import trap.*;
    import trap.publishing.*;
    import java.io.*;
    import java.util.Properties;
    import java.util.Hashtable;
    @SuppressWarnings("serial")
    public class Authenticator
        extends TRAPServletBase{
        Default constructor
        public Authenticator() {
            super();
        public final void doGet(HttpServletRequest req, HttpServletResponse res)
           throws ServletException, IOException
             doPost(req,res);
        Overrides the default doGet() to perform login function.
        @param req HttpServletRequest that encapsulates the request to the servlet.
        @param res HttpServletResponse that encapsulates the response from the servlet.
        @exception javax.servlet.ServletException
                   If the request could not be handled.
        @exception java.io.IOException
                   If there is an error writing to the output stream.
        @SuppressWarnings({ "unchecked" })
         public final void doPost(HttpServletRequest req, HttpServletResponse res)
            throws ServletException, IOException {
            try {
                res.setContentType("text/html");   
                PrintWriter out = getServletPrintWriter(res);
                System.out.println("getting properties now");
           //  Properties properties = getTRAPEnvironment().getProperties();
               Properties properties =   (Properties) getServletConfig().getServletContext().getAttribute("TRAPProperties");
                System.out.println("got properties now");
                String loginTemplate = properties.getProperty("TRAP.template.login");
                String expiredTemplate = properties.getProperty("TRAP.template.expired");
                String mainTemplate = properties.getProperty("TRAP.template.mainFrameSet");
                String userid = req.getParameter("userid");
                String passwd = req.getParameter("passwd");
                if(userid == null) {
                    userid = "";
                if(passwd == null) {
                    passwd = "";
                // Overall properties are passed through to HttpTRAPConnection
                // to initialize ORB...
                Properties connectionProperties = getProperties();
                HttpTRAPConnection conn = new HttpTRAPConnection(
                    connectionProperties, req.getSession(true)
                TRAPSession session = conn.login(userid, passwd);
                if(session.isPasswordExpired()) {
                    Hashtable table = new Hashtable();
                    table.put("MESSAGE","Your password has expired.<BR>" + "Please enter a new password now.");
      //              printTemplate(expiredTemplate, out, table);
                } else {
                    Hashtable myData = new Hashtable();
                    myData.put("DEFAULT_SERVLET",session.getMenu().defaultMenuItem.url);
       //             printTemplate(mainTemplate, out,myData);
            } catch(AccessViolation access) {
                HTMLElement element = HTMLElementFactory.getHTMLElement(
                    HTMLElementFactory.ERROR_ELEMENT
                element.printHTML(getServletPrintWriter(res), access);
            } catch(Exception error) {
                printError(getServletPrintWriter(res), getClass().getName(), error);
    }this is TRAPServletBase
    package trap.publishing;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import aif.persist.DbError;
    import trap.*;
    @SuppressWarnings("serial")
    public class TRAPServletBase
        extends HttpServlet {
          @SuppressWarnings("unused")
         private CachedFileTemplateManager templateMgr = null;
        Default constructor, calls default HttpServlet constructor.
        public TRAPServletBase() {
            super();
        Returns the TRAPSession object for this session, or throws
        an AccessViolation if the session has not logged in.
        @param req The HttpServletRequest for this servlet thread.
        @return TRAPSession for the servlet thread.
        @exception trap.AccessViolation
                   If the user has not yet logged in.
        @exception aif.persist.DbError
         if a database error occurs
        public TRAPSession getTRAPSession(HttpServletRequest req)
            throws AccessViolation, DbError {
            HttpTRAPConnection conn = HttpTRAPConnection.getInstance(req);
            if(conn == null) {
                throw new AccessViolation(AccessViolationType.Authentication);
            } else {
                return conn.getTRAPSession();
        Returns the TrapEnvironmentServlet.
        @return The TrapEnvironmentServlet.
        @exception javax.servlet.ServletException
                   If there is an error retrieving the environment.
         public TRAPEnvironmentServlet getTRAPEnvironment()
            throws ServletException {
              System.out.println("getting TRAPEnvironmentServlet");
            return (TRAPEnvironmentServlet)
         //     getServletContext().getServlet("trapenv");
          //       getServletContext().getNamedDispatcher("trapenv");
       //  getServletContext().getAttribute ("trapenv") ;
         getServletContext().getRequestDispatcher("/servlet/trapenv");
        Prints a template as if getTemplateManager().getTemplate().printHTML()
        were called with null data.
        @param templateName The name of the template to retrieve.
        @param out          The output stream to print to.
        @exception javax.servlet.ServletException
                   If there is an error printing the template.
        public void printTemplate(String templateName, PrintWriter out)
            throws ServletException {
            try {
                HTMLElement element = null;
                element = getTRAPEnvironment().getTemplateElement(templateName);
                element.printHTML(out, null);
            } catch(TemplateNotFoundException tnfe) {
                throw new ServletException(tnfe.getMessage());
        Prints a template as if getTemplateManager().getTemplate().printHTML()
        were called.
        @param templateName The name of the template to retrieve.
        @param out          The output stream to print to.
        @param data         The data object for the template.
        @exception javax.servlet.ServletException
                   If there is an error printing the template.
        public void printTemplate(String templateName, PrintWriter out, Object data)
            throws ServletException {
            try {
                HTMLElement element = null;
                element = getTRAPEnvironment().getTemplateElement(templateName);
                element.printHTML(out, data);
            } catch(TemplateNotFoundException tnfe) {
                throw new ServletException(tnfe.getMessage());
        Logs the error message to the servlet logging mechanism and
        prints a standard error page to the output stream specified.
        @param out   The print writer to render the page to.
        @param where The class/location where the error occurred.
        @param error The exception which caused the error.
        public void printError(PrintWriter out, String where, Exception error)
            throws ServletException, IOException {
            log(error, where);
            HTMLElement element = HTMLElementFactory.getHTMLElement(
                HTMLElementTypes.ERROR_ELEMENT
            element.printHTML(out, error);
        Utility method that takes the HttpServletResponse, retrieves the output
        stream, and creates a new PrintWriter to write to it.
        @param res The HttpServletResponse to retrieve the output stream from.
        @return The PrintWriter that writes to the response's output stream.
        @exception java.io.IOException
                   If the output stream cannot be obtained from the
                   HttpServletResponse.
        public PrintWriter getServletPrintWriter(HttpServletResponse res)
            throws IOException {
            return new PrintWriter(new OutputStreamWriter(res.getOutputStream()));
        Returns the value of the specified property from the properties file
        that was loaded on initialization.
        @param propertyName The name of the property to retrieve.
        @return The value of the specified property.
        @exception javax.servlet.ServletException
                   If the TRAPEnvironment cannot be found.
        @exception java.lang.IllegalArgumentException
                   If the property is not found.
        public String getProperty(String propertyName)
            throws ServletException {
            return getTRAPEnvironment().getProperty(propertyName);
        Returns the value of the specified property from the properties file
        that was loaded on initialization.
        @param propertyName The name of the property to retrieve.
        @param required     <code>true</code> if the property must exist.
        @return The value of the specified property.
        @exception javax.servlet.ServletException
                   If the TRAPEnvironment cannot be found.
        @exception java.lang.IllegalArgumentException
                   If the property is not found, and it was required.
        public String getProperty(String propertyName, boolean required)
            throws ServletException {
            return getTRAPEnvironment().getProperty(propertyName, required);
        Returns the properties object loaded at initialization.
        @return The properties object.
        @exception javax.servlet.ServletException
                   If the TRAPEnvironment cannot be found.
        public Properties getProperties()
            throws ServletException {
              TRAPEnvironmentServlet t = new TRAPEnvironmentServlet();
            return t.getProperties();
        public void log(String reason) {
            try {
                super.log(reason);
            } catch(Exception error) {
                System.err.println("Unable to use servlet logging for:");
                System.err.println(reason);
        public void log(Exception why, String reason) {
            try {
                getServletContext().log(reason);
            } catch(Exception error) {
                System.err.println("Unable to use servlet logging for:");
                System.err.println(reason);
                why.printStackTrace();
    and this is TRAPEnvironmentServlet
    package trap.publishing;
    import java.io.*;
    import java.util.Hashtable;
    import java.util.Properties;
    import javax.servlet.*;
    import javax.servlet.http.*;
    @SuppressWarnings("serial")
    public class TRAPEnvironmentServlet
        extends TRAPServletBase
        implements TemplateManager {
        The system configuration information.
        private Properties properties  = null;
        The template manager that loads templates.
        private CachedFileTemplateManager templateMgr = null;
        private boolean initialized = false;
        private final static String TOKEN_NAME        = "MESSAGE";
        private final static String TOKEN_DEFAULT_REPLACEMENT =
            "Enter your user id and password to log into TRAP";
        Construct the servlet.
        public TRAPEnvironmentServlet() {
            super();
        Initialize the servlet.
        @param config The servlet config object, containing the init parameter
                      TRAP.properties=[path].
        @exception javax.servlet.ServletException
                   If there is an error initializing the servlet.
        public void init(ServletConfig config)
            throws ServletException {
           System.out.println("in the init of TRAPEnvironmentServlet");
             if(initialized) {
                System.err.println("attempt made to reinitialize servlet.");
                return;
            super.init(config);
            try {
                if(config == null) {
                    throw new ServletException(
                        "ServletConfig is not available for initialization."
             // String propertiesPath = config.getInitParameter("TRAP.properties");
                InputStream is = getClass().getClassLoader().getResourceAsStream("config/trap.ini");
              //  properties.load(is);
           /*     if(propertiesPath == null || propertiesPath.equals("")) {
                    throw new ServletException(
                        "No initialize parameters specified for TRAPEnvironmentServlet."
                properties = new Properties();
                try {
                     //properties.load(new FileInputStream(propertiesPath));
                      properties.load(is);
                     String templateRoot = properties.getProperty("TRAP.templateRoot");
                    String loadAllStr   = properties.getProperty("TRAP.loadAllTemplates");
                    boolean loadAll     = false;
                    if(loadAllStr != null) {
                        loadAll = new Boolean(loadAllStr).booleanValue();
                    templateMgr = new CachedFileTemplateManager(templateRoot, loadAll);
                    config.getServletContext().setAttribute("TRAPProperties", properties);
                } catch(java.io.IOException ioe) {
                    log(ioe, "Unable to load properties file.");
                } catch(TemplateNotFoundException tnfe) {
                    log(tnfe, "Unable to load one or more templates.");
            } catch(Exception error) {
                log(error, "An error occurred while initializing the servlet.");
        //    config.getServletContext().setAttribute("TRAPProperties", properties);
            initialized=true;
        public void doGet(HttpServletRequest req, HttpServletResponse res)
            throws ServletException, IOException {
            Hashtable<String, String> table = new Hashtable<String, String>();
            String why = req.getParameter("why");
            if(why == null) {
                table.put(TOKEN_NAME, TOKEN_DEFAULT_REPLACEMENT);
            } else {
                table.put(TOKEN_NAME, why);
            res.setContentType("text/html");
            Properties properties = this.getProperties();
            String loginTemplate = properties.getProperty("TRAP.template.login");   
            this.printTemplate(loginTemplate, getServletPrintWriter(res), table);
        public void doPost(HttpServletRequest req, HttpServletResponse res)
            throws ServletException, IOException {
            PrintWriter out = new PrintWriter(new OutputStreamWriter(res.getOutputStream()));
            out.println("<HTML>");
            out.println("  <BODY>");
            out.println("    <CENTER>");
            out.println("      <H1>");
            out.println("        This servlet should not be reference by a browser.");
            out.println("      </H1>");
            out.println("    </CENTER>");
            out.println("  </BODY>");
            out.println("</HTML>");
            out.flush();
        Returns the value of the specified property from the properties file
        that was loaded on initialization.
        @param propertyName The name of the property to retrieve.
        @return The value of the specified property.
        @exception java.lang.IllegalArgumentException
                   If the property name is not found.
        public String getProperty(String propertyName) {
            return getProperty(propertyName, true);
        Returns the value of the specified property from the properties file
        that was loaded on initialization.
        @param propertyName The name of the property to retrieve.
        @param required     <code>true</code> if the property must exist.
        @return The value of the specified property.
        @exception java.lang.IllegalArgumentException
                   If the property name is not found, but was required.
        public String getProperty(String propertyName, boolean required) {
            String property = properties.getProperty(propertyName);
            if(required && property == null) {
                throw new IllegalArgumentException(
                    propertyName + " was not found in the properties object."
            return property;
        Returns the properties object loaded at initialization.
        @return The properties object.
        public Properties getProperties() {
             System.out.println("getting properties now");
            return properties;
        Wraps access to the template manager, returning the template root.
        @return The template root.
        public String getTemplateRoot() {
            return templateMgr.getTemplateRoot();
        Wraps access to the template manager, sets the new template root.
        @param root The new template root.
        public void setTemplateRoot(String root) {
            templateMgr.setTemplateRoot(root);
        Wraps access to the template manager, returns the
        template associated with the specified name.
        @param name The name of the template to return.
        @return The HTMLElement representing the loaded template.
        @exception trap.publishing.TemplateNotFoundException
                   If the template cannot be successfully loaded.
        public HTMLElement getTemplateElement(String name)
            throws TemplateNotFoundException {
            return templateMgr.getTemplateElement(name);
    }this is my code
    thanks for help

  • How to replace hard drive bay fan?

    The fan in my G5 tower dual 1.8 Ghz in the top bay - optical/hard drive bay - has started to make noise. I bought a replacement, but I don't see any way to get the old one out. It sits in a little depression in the bay floor, and even if I got out the 3 screws holding it in place, it won't tilt far enough front or back to slide out.
    Anyone know of any write-up anywhere about how to replace this fan assembly?

    Those two fans (media bay fans) are only given a mention in the "official" service manual.
    The drive fan and blower located between the optical and hard drives cannot be
    replaced. You must replace the enclosure for these two parts.
    Does this mean the "entire" enclosure, as in the tower, or just an enclosure for the fans held to the tray of the media bay?
    I don't know.
    Maybe someone who has done this can offer advice, but it seems that there is a need for someone to write a manual for that procedure.
    Message was edited by: japamac

  • How to replace power adapter for PowerBook G4

    I have a three year old powerbook G4 and the power adapter is toast (at least I think that's the problem). Doesn't charge and no illuminated ring around the connector to the computer.
    Does anyone know how to replace this? Can't find it anywhere online or at Mac retailers.
    Thanks.

    Replace the power adapter plug? Most folks won't bother, it's a hassle. The whole adapter is easily available from any Mac vendor. But before replacing anything, have you tried the following:
    -reset the Power Management Unit (PMU)
    http://support.apple.com/kb/HT1431?viewlocale=en_US
    -reset the PRAM
    http://support.apple.com/kb/HT1431?viewlocale=en_US
    -unplug the power adapter from the wall socket for a while to reset.

  • My hard drive on my MacBook Pro stopped working and I had to replace the hard drive.  I cannot get my playlists and photos to appear in my iTunes and iPhoto.  Does anyone know how to resolve this?

    My hard drive on my MacBook Pro stopped working and I had to replace the hard drive.  I cannot get my playlists and photos to appear in my iTunes and iPhoto.  Does anyone know how to resolve this?

    Peace Lilly wrote:
    ...  Will I loose everything if I connect the iphone to the itunes as a new device?
    To avoid that...
    See these 2 Links...
    Syncing to a New Computer...
    https://discussions.apple.com/docs/DOC-3141
    Recovering your iTunes library from your iPod or iOS device
    https://discussions.apple.com/docs/DOC-3991

  • How to fix this error "this iPad is not able to complete the activation process. Please press Home and start over. If the issue persists, please visit your nearest Apple Store or Authorized service provider for more information or replacement"?

    How to fix this error "this iPad is not able to complete the activation process. Please press Home and start over. If the issue persists, please visit your nearest Apple Store or Authorized service provider for more information or replacement"? When I plugged in my iPad this popped up!

    Hi csreddy, 
    If you are receiving a message to contact an Apple Retail Store or Authorized Service Provider for help updating from iOS 3, click on the link below to initiate that support:
    Update the iOS software on your iPhone, iPad, and iPod touch - Apple Support
    http://support.apple.com/en-us/HT204204
    Update your device using iTunes
    If you can’t update wirelessly, or if you want to update with iTunes, follow these steps:
    Install the latest version of iTunes on your computer.
    Plug in your device to your computer.
    In iTunes, select your device.
    In the Summary pane, click Check for Update. 
    Click Download and Update.
    If you don't have enough free space to update using iTunes, you'll need to delete content manually from your device.
    Find out what to do if you get other error messages while updating your device.
    Last Modified: Jan 12, 2015
    Apple - Find Locations
    https://locate.apple.com
    Contact Apple for support and service - Apple Support
    http://support.apple.com/en-us/HT201232
    Regards,
    - Judy

  • My iphone 4s is over 2 years old and I need to replace the battery. How much will this cost at an Apple store?

    I have an iphone 4s that is  over 2 years old. The phone's battery is no longer able to hold a  charge for an acceptable length of time.  Assuming I need to replace the battery, how much will this cost at an Apple store?

    graciebethgrant wrote:
    Basically, I'm new to Apple, despite using them before, but I've never actually owned my own.
    Since buying this phone off a colleague at work, I seem to be having problems with it. First, I noticed how rubbish the battery life is, then my charger almost went up in flames and thirdly my camera lense is scratched beyond belief.
    I know the phone isn't within warranty, although I was lead to believe it was before and during buying it, so basically I'm extremely disappointed with the general make up of iPhone's considering they cost such a **** of a lot of money, you'd think they'd be built to last.
    Back to my main point, how much would it cost for a new battery? Or a new camera lense if anyone can help me with that? (I know that the back of the phone was refurbished just before my buying it, so literally just the camera lense)
    Thanks!
    So basically it sounds like you bought an abused used iPhone and somehow that makes the phone subpar because dispite the abuse it should still last forever and look like new? Batteries don't last forever, even under ideal conditions, so your expectatoins are unrealistic. Take it in and have an estimate done.

  • I synced my iPhone to my husband's computer and it wiped out his iTunes account replacing his content with the content of my iTunes account. Any idea how to fix this?

    I synced my iPhone to my husband's computer not knowing that it would wipe out his iTunes account and replace his content with mine. Obviously, not good. Any ideas on how to fix this??

    Syncing an iphone should have no effect at all on the content of the computer.
    Are you saying the the itunes library on the computer was effected?

  • My old MobileMe account surfaced when I was on a support call. I didn't discover it until the case was closed. How can I replace this obsolete account with my current iCloud account?

    My old MobileMe account surfaced when I was on a support call. I didn't discover it until the case was closed. How can I replace this obsolete account with my current iCloud account?

    Do you mean that you were using the Apple ID which is your ex-MobileMe address? It's still an Apple ID, even though MobileMe itself is dead, and there's nothing to stop you from using it as an ID with Support, or logging in here or in iTunes with it. You should make sure you have a functioning non-Apple email address associated with it.
    Did you migrate your MobileMe account to iCloud before 1 August last? If so, you can set up an iCloud account using it, or if you have already set up a new and separate iCloud account you can still log in with it in System Preferences>Mail, Contacts and Calendars so that it runs alongside your iCloud account.
    If you didn't migrate you can still reactivate the address the same way.
    Anything where you've logged in with the ex-MobileMe address, such as support for something you registered using it or a server such as iTunes, will need to continue using it.

  • System Preferences quits suddenly. I have lost the dock, including the trash and ability to change desktop image. How can I replace this part of System Preferences? Where can I find Trash?

    System Preferences quits suddenly. I have lost the dock, including the trash and ability to change desktop image. How can I replace this part of System Preferences? Where can I find Trash? All other aspects of System Preferences work.

    just that that is one method, and lacks provision for working boot image and for an emergency - Lion gives a small minimal emergency boot environment but may lack all the utilities you need to use and run, even some drivers that your mac requires for add on PCIe.
    Just grab and look through Help in Carbon Copy and SuperDuper, both excellent and each has their use - together - for cloning.
    And do you have two TM backup sets? ought to consider that also, rotate daily or make a weekly set. Otherwise you are putting all your eggs in the proverbial one basket.

  • HT201295 Recently Apple replaced the hard drive on Mac running Yosmite 10.10.2 and now when i try to rn FaceTime, the computer says "no camera available". Does anyone no how to fix this?

    Recently Apple replaced the hard drive on Mac running Yosmite 10.10.2 and now when i try to rn FaceTime, the computer says "no camera available". Does anyone no how to fix this?

    Assuming there is no hardware problem try reinstalling Yosemite. If this does not work then take it back to the Apple Store.
    Reinstalling OS X Without Erasing the Drive
    Boot to the Recovery HD: Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Reinstalling OS X Without Erasing the Drive
    Repair the Hard Drive and Permissions: Upon startup select Disk Utility from the main menu. Repair the Hard Drive and Permissions as follows.
    When the recovery menu appears select Disk Utility and press the Continue button. After Disk Utility loads select the Macintosh HD entry from the the left side list.  Click on the First Aid tab, then click on the Repair Disk button. If Disk Utility reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit Disk Utility and return to the main menu.
    Reinstall OS X: Select Reinstall OS X and click on the Continue button.
    Note: You will need an active Internet connection. I suggest using Ethernet if possible because it is three times faster than wireless.
    Also see:
    Reinstall OS X Without Erasing the Drive
    Choose the version you have installed now:
    OS X Yosemite- Reinstall OS X
         Note: You will need an active Internet connection. I suggest using Ethernet
                     if possible because it is three times faster than wireless.

  • How do you fix error message "data rate for this file is too high for DVD.  You must replace this file with one of a lower data rate".

    When trying to burn a DVD it will go through the encoding step and at 98% we see the message 'data rate for this file is too high for DVD.  You must replace this file with one of a lower data rate".  We need help to correct this so we can complete burning to DVD. 

    What did you export from Premiere?
    Did you use the MPEG2-DVD preset... and did you make any changes to the preset?
    CS5-thru-CC PPro/Encore tutorial list http://forums.adobe.com/thread/1448923 may help

  • My iPod was stolen and insurance company want it's serial number before replacing it. They have advised iTunes stores this information as a device connected to iTunes. Can anyone advise how I find this information?

    IiPod serial number stored in iTunes, can anyone advise how I find this information for my insurance company?

    Juliebathgate wrote:
    IiPod serial number stored in iTunes, can anyone advise how I find this information for my insurance company?
    Hi,
    If you have made a backup at any time of your iPod in iTunes, it should be in Preferences, under Devices tab.
    In iTunes
    Open iTunes Preferences.
    From the Preferences window click on the Devices.
    Once you are there you should see a list under "Device Backups:".
    Hover your mouse pointer to the device and in a little while it should display the serial number of the device (with an iPhone it will also display a phone number used with it and the IMEI code and with an iPad it will display the IMEI in addition to the serial number).
    A pircture of where it can be found: http://km.support.apple.com/library/APPLE/APPLECARE_ALLGEOS/HT4946/en_US/HT4946- devices-iphone-001-en.png

  • How to do this find and replace?

    I have been trying to figure out the regex for this find and replace (I thought it would be easy!), but my frustration is getting the better of me and any help would be greatly appreciated.  I'm trying to do two find and replaces:
    1) In the first, I'd like to find:
    </script>
    XXXX
    </head>
    where XXXX are always four letters (uppercase) and I want to store the four letters as a variable ($1) to use in the replace
    I'd like to replace this with a bunch of javascript and in the middle of the script, I'd place the variable referencing these four letters (<script type="text/javascript">var blah = new Spry.Data.XMLDataSet("http://$1.com"blahblah</script></head>
    2) The second find is similar:
    </html>
    XXXXXXXX
    where once again X are 8 letters in uppercase following the close of the html tag (this has resulted from previous find and replaces and now I'm trying to correct things)
    I simply want to delete these letters in this case (so will leave the replace blank).
    Any help is greatly appreciated!  Thank you

    Having 46 people view a post without replying is not unusual. Some people look at a question to see if it's something they'd like to know the answer to, and then come back  when it has eventually been answered.
    I'm not sure if you need to escape forward slashes in Dreamweaver's Find and Replace dialog box, but I normally do because both JavaScript and PHP normally use forward slashes as delimiters to mark the beginning and end of the regex like this:
    var pattern = /[A-Z]{4}/; // JavaScript
    $pattern = '/[A-Z]{4}/';   // PHP
    When a forward slash appears inside the regex, you need to escape it with a backslash to avoid confusion with the closing delimiter.
    As you have worked out, a capturing group is created by wrapping part of the regex in parentheses.
    If you want to match exactly 38 characters, you can use [\S\s]{38}. That includes spaces, newline characters, symbols, everything.
    If you're trying to find everything between two tags, you can do this:
    (<\/tag_name>)([^<]+)
    The closing tag is captured as $1 and everything up to the next opening tag is captured as $2.
    Learning regular expressions is not easy. I don't claim to be an expert, but I enjoy the challenge of trying to solve them. If you're interested in regular expressions, there are several books published by O'Reilly. "Mastering Regular Expressions" is the ultimate authority, but it's a difficult read (not because it's badly written, but because of the complexity of the subject). "Regular Expressions Cookbook" is very good. There's also a new "Introducing Regular Expressions", but I haven't read it.

  • Messages on my MacBook Air won't send messages over iMessage. Anyone know how to fix this?

    In preferences, under accounts, it claims that my Apple iD is hooked up to messages, including my phone number and email address...yet it isn't sending messages they always fail. Does anyone know how to fix this problem? It would be a great help.

    Read this whole message before doing anything.
    Back up all data.
    Quit Messages if it’s running.
    Step 1
    Hold down the option key and select
    Go ▹ Library
    from the Finder menu bar. Move the following items from the Library folder to the Trash (either may not exist):
    Caches/com.apple.Messages
    Caches/com.apple.imfoundation.IMRemoteURLConnectionAgent
    Leave the Library folder open. Log out and log back in. Try Messages again. If it works now, stop here. Close the Library folder.
    Step 2
    If you still have problems, quit Messages again. Go back to the Finder and move the following item from the open Library folder to the Desktop:
    Messages
    Note: you are not moving the Messages application. You’re moving a folder named “Messages.”
    Test. If Messages now works, delete the Messages folder on the Desktop. Otherwise, quit Messages again. Put back the folder you moved, overwriting the newer one that may have been created in its place, and continue.
    Step 3
    In the Preferences subfolder, there may be several files having names that begin with "com.apple.iChat". Move them all to the Desktop. There may also be a file with the name "com.apple.imagent.plist". Move that to the Trash.
    Also in the Preferences folder, there's a subfolder named "ByHost". Open it and do the same thing.
    Log out and log back in. Test again. This time Messages should perform normally, but your settings will be lost. You may be able to put back some of the files you moved to the Desktop in this step. Relaunch and test after each one. Eventually you should find one or more that causes Messages to malfunction. Delete those files and recreate whatever settings they contained.
    If the issue is still not resolved, quit Messages again and put all the items you moved to the Desktop back where they were. You don’t need to replace the items you moved to the Trash. Stop here and post again.
    If you later decide that you don’t like the results of steps 2 and 3, you can undo them completely by quitting Messages and restoring the items you deleted in those steps from your backup.

Maybe you are looking for

  • Error in setting up debugging: Source not found for Catalina.createStartDigester() line: 280

    I am trying to set up the development environment using Portal (5.0.4), Eclipse and Tomcat-4.1.30-LE. I've set up Eclipse according to the instruction of "Debugging portal source code: Eclipse". I got the following error when I select "Run | Debug" i

  • Using a Model in an Aggmap

    I have an aggmap which contains a relation statement to aggregate a Line Item dimension, and it also contains a model statement which I intend to calculate some Line Items after the aggregation has occurred. However, in a very simple test of this app

  • Bridge Output non existent

    Hi, Just got Photoshop CS5 and when I went to try to make a photo gallery I found that my Output window (where all the photogallery options are) is not there just a grey box where the options should be.  I know what it should look like after watching

  • Music not playing in car when it used to...

    I have been using my iPhone in my car for the past 8 months. It's an integrated system within an Infiniti. Today, when I plugged in the phone, it said that the iPod was not connected. It was. I unplugged and plugged in again. Same message. Then, I un

  • 2 iphones 1 comuter - how to get 2 different calendars and contacts on each

    I have been using my iphone 3G for a few months and syncing to outlook for contacts, calendar and notes. My wife has just got her own phone (3G). She logs in to the computer with her own account and has her own itunes library so there is no problem w