String Param tag replace with Br tag

original text:
<P ALIGN="LEFT">sample text1</P><P ALIGN="LEFT">sample text2</P><P ALIGN="LEFT">sample text3</P>
I need to: <br/>sample text1<br2>sample text2<br2>sample text3
can help me

var reg:RegExp = /\<\/?P.*?\/?\>/igm;
  var _m=messageField.htmlText//<P ALIGN="LEFT">sample text1</P><P ALIGN="LEFT">sample text2</P><P ALIGN="LEFT">sample text3</P>
  _m=_m.replace(reg, '<br/>');
trace(_m) //  "<br/>sampletext1<br/><br/>sampletext2<br/><br/>sampletext3<br/>"
Iam getting double breaks i need only one break.
Re: String Param tag replace with Br tag 

Similar Messages

  • Search given string array and replace with another string array using Regex

    Hi All,
    I want to search the given string array and replace with another string array using regex in java
    for example,
    String news = "If you wish to search for any of these characters, they must be preceded by the character to be interpreted"
    String fromValue[] = {"you", "search", "for", "any"}
    String toValue[] = {"me", "dont search", "never", "trip"}
    so the string "you" needs to be converted to "me" i.e you --> me. Similarly
    you --> me
    search --> don't search
    for --> never
    any --> trip
    I want a SINGLE Regular Expression with search and replaces and returns a SINGLE String after replacing all.
    I don't like to iterate one by one and applying regex for each from and to value. Instead i want to iterate the array and form a SINGLE Regulare expression and use to replace the contents of the Entire String.
    One Single regular expression which matches the pattern and solve the issue.
    the output should be as:
    If me wish to don't search never trip etc...,
    Please help me to resolve this.
    Thanks In Advance,
    Kathir

    As stated, no, it can't be done. But that doesn't mean you have to make a separate pass over the input for each word you want to replace. You can employ a regex that matches any word, then use the lower-level Matcher methods to replace the word or not depending on what was matched. Here's an example: import java.util.*;
    import java.util.regex.*;
    public class Test
      static final List<String> oldWords =
          Arrays.asList("you", "search", "for", "any");
      static final List<String> newWords =
          Arrays.asList("me", "dont search", "never", "trip");
      public static void main(String[] args) throws Exception
        String str = "If you wish to search for any of these characters, "
            + "they must be preceded by the character to be interpreted";
        System.out.println(doReplace(str));
      public static String doReplace(String str)
        Pattern p = Pattern.compile("\\b\\w+\\b");
        Matcher m = p.matcher(str);
        StringBuffer sb = new StringBuffer();
        while (m.find())
          int pos = oldWords.indexOf(m.group());
          if (pos > -1)
            m.appendReplacement(sb, "");
            sb.append(newWords.get(pos));
        m.appendTail(sb);
        return sb.toString();
    } This is just a demonstration of the technique; a real-world solution would require a more complicated regex, and I would probably use a Map instead of the two Lists (or arrays).

  • Parsing & handling of object and param tags

    Hi all,
    I'm working on allowing people to paste certain embedded video code into a wysiwyg / html editor we've built with the help of (amongst others) javax.swing.text.html.HTMLWriter.
    I'm facing the following problem here:
    When i try to parse the <object><param></param></object> piece, it removes the <param> tags, and incorporates these in the <object> tag. For example:
    <object width="300" height="250"><param name="allowscriptaccess" value="always"></param></object>becomes:
    <object width="300" height="250" allowScriptAccess="always"></object>All param tags get converted into the object tag as String attributes. Problem with this is that the allowScriptAccess attribute is not a valid attribute of the object tag.
    Is there any way to prevent this conversion so it will retain the <param> tags?
    Thank you in advance.
    Edited by: Floxxx on Dec 28, 2009 10:16 AM

    This seems to be default behaviour in HTMLWriter, function Write().
    There it retrieves all elements with their attributes. The attributes summed up in the param tags show up as attributes for the object tag.
    Edited by: Floxxx on Dec 28, 2009 10:54 AM

  • SSI PARAM tag

    We are trying to implement server side includes for our servlets, but are
              having difficulty retrieving parameters passed using the param tag. Our
              shtml code is as follows:
              <HTML>
              <BODY>
              <SERVLET NAME=NavigationServlet>
              <PARAM NAME=Path VALUE=Job>
              </SERVLET>
              </BODY>
              </HTML>
              Inside the servlet, we run the following code to try to retrieve the value
              of "Path":
              String path = req.getParameter("Path");
              This returns null. If we try to pass the path as part of the URL
              (http://hostname/weblogic/test.shtml?Job=Path), the above statement is able
              to retrieve it; it only fails when passed in the <PARAM> tag on the .shtml
              page. Any ideas?
              Dave
              

    Yup! We're experiencing the exact same problem here! The only diff is our
              page code is in a .html file, and we direct *.html to SSIServlet. Here's
              the kicker: We have been doing this all through WL 4.5.1, and it WORKED
              THEN! The <PARAM> tag stopped working as of 5.1 upgrade! (Or perhaps it
              has something to do with JSDK 2.2 upgrade from 2.1, which we did
              concurrently with 5.1 upgrade)
              What's going on, and what's the solution, other than appending all our param
              name-values to the end of the servlet alias tag???
              Gene
              "David Salpeter" <[email protected]> wrote in message
              news:01bfa3bb$029b3080$4dea7bcf@7926CY570369...
              > We are trying to implement server side includes for our servlets, but are
              > having difficulty retrieving parameters passed using the param tag. Our
              > shtml code is as follows:
              >
              > <HTML>
              > <BODY>
              > <SERVLET NAME=NavigationServlet>
              > <PARAM NAME=Path VALUE=Job>
              > </SERVLET>
              > </BODY>
              > </HTML>
              >
              > Inside the servlet, we run the following code to try to retrieve the value
              > of "Path":
              >
              > String path = req.getParameter("Path");
              >
              > This returns null. If we try to pass the path as part of the URL
              > (http://hostname/weblogic/test.shtml?Job=Path), the above statement is
              able
              > to retrieve it; it only fails when passed in the <PARAM> tag on the .shtml
              > page. Any ideas?
              >
              > Dave
              

  • Init-param tags and related settings?

    Hello all,
    I am completely new to all this and just recently started training for a product called ServiceCenter and was wondering how the servlet technology works in conjunction with the product.
    There are servlet tags available in the web.xml for servlet names AttachmentDownload, FileDownload, FileUpload, ImageUpload, AttachmentUpload, UniqueUpload, Attachment, Image, Messages, HtmlViewer, SCLink, NavMenu, and ThemeServlet.
    At this time I can find no documentation available for all the init-param tags and related settings along with explanations. If I can understand how this works, I'm sure I can get the appropriate info from the SC engineers.
    And when I say I'm new to this, even that is an understatement but I look forward to a looong career and learning every bit of information passed my way.
    Thanks,
    Andrew

    Sounds like 3rd party API.
    First find out the package names for all of that stuff and then google on that to find the manfacturer's website.

  • JSP Compilation problem - fmt:param tags

    Weblogic server 9.1 throws validation errors for jstl fmt:param tags. Body content is present so I'm not sure why the validation error. My code appears below :
              <fmt:message key="project.overview.archived.error"><fmt:param>${fn:escapeXml(baseAppViewBean.currentProjectName)}</fmt:param></fmt:message>
              The error is :
              The page failed validation from validator: "A body is necessary inside the "fmt:param" tag, given its attributes.".

    Found a solution to the problem. As long as there is a space between the end of the fn tag and the closing fmt:param tag, it works in 9.1. The following code works-
              This issue has been filed with BEA and will be addressed in a patch or a version after 9.2.
              <c:set var="imgAlt"><fmt:message key="document.type.508"><fmt:param>${fn:escapeXml(documentUIBean.displayString)} </fmt:param>
              </fmt:message></c:set>

  • Reading the PARAM tags in advance???

    Hi,
    I have just started working on GUI's in HTML using applets.
    In order to make an applets fully configured from the html though,
    the use of the PARAM tags is necessary.
    Is it possible to read in the beginning of the applet all the PARAM tags
    entered in the html document?
    Thank you for your time.

    What you could do, however, is to have one parameter that tells the names of the other parameters present, as a comma-separated list.
    <param name="parameters" value="imagelist,lang_prop_file">
    <param name="imagelist" value="images.dat">
    <param name="lang_prop_file" value="jp.prop">
    Then you can use that first parameter to make an array or vector or hastable yourself:     String s = getParameter(name);
        if ("".equals(s) || s == null) {
            System.err.println(
                "No parameter " + name + " in applet tag");
            return null;
        java.util.StringTokenizer st =
            new java.util.StringTokenizer(s, ",");
        String[] parameterNames = new String[st.countTokens()];
        for (int i = 0; i < parameterNames.length; ++i) {
            parameterNames[i] = st.nextToken();
        HashTable parameters;
        for (int j=0; j<parameterNames.length; ++j) {
            parameters.put(parameterNames[j],
                           getParameter(parameterNames[j]);

  • Replace " with ' in a string

    I need to replace " with '.
    Does any have a solution? The follwing code has a problem to define
    sString replace =""";
    public String replace(String str, String pattern, String replace) {
    int s = 0;
    int e = 0;
    StringBuffer result = new StringBuffer();
    while ((e = str.indexOf(pattern, s)) >= 0) {
    result.append(str.substring(s, e));
    result.append(replace);
    s = e+pattern.length();
    result.append(str.substring(s));
    return result.toString();
    Thanks.
    Jian

    use "\"" instead

  • JSTL fmt:param tag question

    <%@taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%>
    <fmt:message key="result_display">
         <fmt:param value="${resultBean.sourceNumber}"/>
         <fmt:param value="${resultBean.resultValue}"/>
    </fmt:message>
    As far as I can tell, the "value" attribute of the <fmt:param> tag is capable of taking an EL. And yet, the code above does not compile. I get the error message "According to TLD or attribute directive in tag file, attribute value does not accept any expressions". If I use the <fmt_rt:param> tag, everything works fine. Am I reading the spec wrong?

    You're not reading the spec wrong, but I think you are using the wrong version of JSTL. Are you using Tomcat 5? (Or another JSP2.0 container?)
    If so, you should be using JSTL1.1
    It has a uri of "http://java.sun.com/jsp/jstl/fmt"
    Note the extra /jsp in there.
    Tomcat 5 treats ${  } as runtime expressions. To a JSP2.0 container, they ARE runtime expressions. Thus in JSTL 1.1, the fmt:param tag does accept runtime expressions.
    In JSTL1.0 because the ${  } expressions WEREN'T understood by the container, they made the tags so as not to accept runtime expressions, and called their custom evaluator.
    You are using the 1.0 uri, which specifies that it doesn't accept runtime expressions. It is complaining that ${ } is a runtime expression - so you must be using a JSP2.0 container.
    In short: You probably have a JSP2.0 container, and should be using JSTL1.1 uri: <%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
    Cheers,
    evnafets

  • [svn] 3313: Fix for SDK-16981 - @ param tag does not recognize tab character as delimiter between paramName and paramDescription

    Revision: 3313
    Author: [email protected]
    Date: 2008-09-23 10:02:50 -0700 (Tue, 23 Sep 2008)
    Log Message:
    Fix for SDK-16981 - @param tag does not recognize tab character as delimiter between paramName and paramDescription
    QA: Yes
    Doc:
    Tests: checkintests
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-16981
    Modified Paths:
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/TopLevelClassesGenerator.ja va

  • Applet's Param Tag

    What are uses of Param tag?
    Can I get some demo programmes which uses param tag?

    <OBJECT
    classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    width="500" height="350" align="baseline"
         codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0">
    <PARAM NAME="code" VALUE="psw.applets.um.UserManager.class">
    <PARAM NAME="archive" VALUE="CriJacsUm.jar">
    <PARAM NAME="codebase" VALUE=".">
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.2.2">
    <PARAM NAME="ServerIP" VALUE="<%=ComDef.ServerIP%>">
    <COMMENT>
    <EMBED type="application/x-java-applet;version=1.2.2"
    width="500" height="350" align="baseline"
    code="UserManager.class" archive="CriJacsUm.jar" codebase="."
         pluginspage="http://java.sun.com/products/plugin/1.2/plugin-install.html">
    <NOEMBED>
    </COMMENT></NOEMBED>
    </EMBED>
    </OBJECT>

  • I want to replace "\" with "/" in a string.

    I tried this...
    String whatever = myString.replace("\\", "/");
    ...and this...
    String whatever = myString.replace("\", "/");
    ...but I get an error.
    I was able to get it to work doing it this way...
    String slashStr = "\\/";
    char slashArr[] = slashStr.toCharArray();
    whatever = whatever.replace(slashArr[0], slashArr[1]);
    But I think that is silly.
    Can someone tell me why the first method won't work?

    String whatever = myString.replace("\\", "/");
    String.replace
    ...and this...
    String whatever = myString.replace("\", "/");
    ...but I get an error.This is correct. There is no method String.replace(String,String)
    only String.replace(char,char)
    I was able to get it to work doing it this way...
    String slashStr = "\\/";
    char slashArr[] = slashStr.toCharArray();
    whatever = whatever.replace(slashArr[0], slashArr[1]);
    But I think that is silly.It is a bit.
    String s1 = "This\\Is\\The\\Original";
    String s2 = s1.replace('\\','/');
    ...Or something like that... Single quotes indicate a char literal
    - double-quotes indicate a string literal.
    Talden

  • How to replace the string of column value with other column value in same table

      
    I have a temp table  which contains 
    Id  Name CTC   Address                      Content
    1    Ross  $200   6th block                  Dear #Name your  CTC  is #CTC and your address is  #address
    2   Jhon   $300   1oth cross                 Dear #Name your  CTC  is #CTC and your address is  #address
    Now i want to  select content    so that it should get  replace with  the respective  columns  and final output should come like this 
     Dear Ross your  CTC  is 200 and your address is    6th block  
      Dear Jhon your  CTC  is 300 and your address is   10th cross  
    Kindly suggest

    I think RSingh suggestion is ok ... what do you mean by another way? ...maybe something more generic?
    maybe build a table whith the list of col you need to "replace" and dinamically build the replace query ...
    declare @colList table(colName varchar(100))
    insert into @colList
    select 'name'
    union all select 'ctc'
    union all select 'address'
    declare @cmd varchar(2000)
    select @cmd='select '+ (select 'replace(' from @colList for xml path('') +' content '+
    (select ',''#'+ colName +''', '+ colName +')' from @colList for xml path(''))
    +' from YOURTABLENAME '
    exec (@cmd)
    or your request was different ?

  • [Perm] Find something, replace with nothing?

    I need to remove tags from a manuscript. In PageMaker I was able to search for:
    <A>
    and replace with:
    [nothing]
    This automated the process of deleting the extraneous text. However in InDesign, leaving the "Replace" field blank does not delete text. So there is seemingly no way to automated this deletion (in one step at least).
    Any suggestions would be appreciated.
    --Stephen

    Here you go. This script processes the selected story (either put your text cursor in the story or select one of its frames) and interprets PageMaker-like paragraph style tags.
    If you have no tags, the paragraphs will all be left with "No Paragraph Style" so don't run it against a previously processed story.
    If you don't tag a paragraph in the middle of the story, it will assume the style of the previous paragraph.
    The script creates styles on the fly if they don't already exist.
    If a paragraph starts with a "<" but has no ">" it's treated like a paragraph with no tag. Same for one that is tagged "<>".
    I've not exactly tested it thoroughly, but it looks as though it works.
    Warning: this version has a bug corrected two messages later.
    tell application "InDesign 2.0.1"
    set theStory to parent of selection
    if class of theStory is story then
      set theLim to count of paragraphs of theStory
      set theStyles to name of every paragraph style of document 1
      set curStyle to "[No paragraph style]"
      repeat with n from 1 to theLim
       set theChar to character 1 of paragraph n of theStory
       copy curStyle to theStyleName
       if theChar = "<" then
        set theText to contents of paragraph n of theStory
        set theOffset to (offset of ">" in theText)
        if theOffset > 2 then
         set theStyleName to characters 2 through (theOffset - 1) of theText as string
         if theStyleName is not in theStyles then
          tell document 1
           set newStyle to make paragraph style
          end tell
          set name of newStyle to theStyleName
          copy theStyleName to end of theStyles
         end if
         delete characters 1 through theOffset of paragraph n of theStory
        end if
       end if
       set applied paragraph style of paragraph n of theStory to paragraph style theStyleName of document 1
       copy theStyleName to curStyle
      end repeat
    end if
    end tell
    Dave

  • My file names have disappeared in grid view. Thery have been replaced with a dark bar along the bottom of the previews. If I toggle using the command u it hide the bar but I still can't see the file name. In list view all the file names are OK.

    My file names have disappeared in grid view. Thery have been replaced with a dark bar along the bottom of the previews. If I toggle using the command u it hide the bar but I still can't see the file name. In list view all the file names are OK.

    The dark bar is caused by the option "Show metadata below image".
    Check the settings for the metadata overlays in Grid view (basic and expanded) by clicking the little "badge" icon below the Browser and selecting "Edit". Is the filename still enabled in the list? And in a high enough position to have precedence for other metadata tags, if the space does not suffice to show all selected tags?
    Regards
    Léonie

Maybe you are looking for

  • Command + F2 does not turn iMac into a screen

    hi, i am trying to use my 27" iMac as a screen to my Macbook Pro Retina. I have the thunderbolt cables plugged in, but pressing Command + F2 does not work. Yes i am pressing these buttons on the iMac. The first time i tried it a few days ago, the iMa

  • Time Machine in loop after upgrade to new mac

    Hello everyone, I just bought a new MacBook to substitute my old iMac. With this upgrade I also went from OS X 10.5.8 (iMac) to 10.6.4 (new MacBook). On installation I chose for the Migration Assistant to copy my data from the latest TM Backup. Every

  • Problem while scheduling info package using HR datasource.

    hi experts, while scheduling the info package i am getting the following error. Delete init. request REQU_D340A67OSEQ9A6Q2B20X9SIOM before running init. again with same selection I think by deleting the setup it will work... am i right or is there an

  • How can I cause captions to be displayed in a slide show or when playing a DVD of an album?

    I want to add captions to images and then cause them to be displayed along with the image when playing a slide show or DVD.

  • Can't send talktalk emails from apple mail.

    My talk talk inbox on the apple mail programme is stubbornly empty and I can't send emails from it. My aol account works fine. It's a POP setting account I think and the incoming port number is correct at 110. Don't know how to check the outgoing por