Results 1 to 10 of 10
  1. #1
    SwissR is offline Member
    Join Date
    Jul 2010
    Posts
    39
    Rep Power
    0

    Default The $ symbol in a string

    Hi Guys,

    Im trying to return the value of a substring stored between two other strings. lets say String Bbeg (beginning) and String end (end) the problem is my pattern search wont allow for the String beg value ("<$") and its really beginning to annoy me. Is there an easy way around this?

    regards S

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,412
    Rep Power
    25

    Default

    pattern search wont allow
    If there are errors, please copy and paste them here with the line(s) of code causing the error.

  3. #3
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,524
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by SwissR View Post
    Hi Guys,

    Im trying to return the value of a substring stored between two other strings. lets say String Bbeg (beginning) and String end (end) the problem is my pattern search wont allow for the String beg value ("<$") and its really beginning to annoy me. Is there an easy way around this?

    regards S
    You're talking about regular expression, right? The $ character is a meta character in the regular expression syntax: it means 'match the end of a line'; the < character does something special too but I forgot what exactly.

    If you want to use those characters as ordinary characters you have to escape them both with a backslash: \<\$; but there's a little pitfall: if you want to pass that String in your Java source you have to get passed the Java compiler javac; it also uses backslashes for escape purposes but not regular expression purposes. You can escape the special meaning of a backslash with another backslash, so your regular expression ends up as: "\\<\\$" as a String literal.

    kind regards,

    Jos

  4. #4
    SwissR is offline Member
    Join Date
    Jul 2010
    Posts
    39
    Rep Power
    0

    Default

    Hi guys thanks for the reply.

    I actually get no errors is the compiler. Even my error trapping comes through it simply does not capture any data to write to the file.

    When i tried Josahs example that returned alot of what I am trying to capture but it also returned alot of things i didn't want.

    The trouble is im trying to return a list of Idoc variables which are all going to be something like <$value$> so how do I go about doing that if im skipping the $ symbol lol.

  5. #5
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,524
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by SwissR View Post
    The trouble is im trying to return a list of Idoc variables which are all going to be something like <$value$> so how do I go about doing that if im skipping the $ symbol lol.
    If you want to include those dollar signs and all in your result read about 'capturing groups' in the Pattern class API (it's all about regular expressions).

    kind regards,

    Jos

  6. #6
    SwissR is offline Member
    Join Date
    Jul 2010
    Posts
    39
    Rep Power
    0

    Default

    Do you by any chance have a decent link that could point me in the right direction, by googling im finding a few relating to integers but nothing mentioning symbols.

    regards S

  7. #7
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,524
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by SwissR View Post
    Do you by any chance have a decent link that could point me in the right direction, by googling im finding a few relating to integers but nothing mentioning symbols.

    regards S
    You are not trying to tell me that you're attempting to program in Java without at least a permanent bookmark to the API documentation, are you?
    here it is.

    kind regards,

    Jos

  8. #8
    SwissR is offline Member
    Join Date
    Jul 2010
    Posts
    39
    Rep Power
    0

    Default

    Hi Guys,

    I have a link to the sun site, by typing in what you want and generally getting what you want are two different things. I just figured that by you knowing it would be better to ask for a direct and correct link. Rather than something potentially misleading thats all.

    Also i've used the search criteria as "<\\$" "\\$>"
    But thats also not good enough, the file write response was massive and not even all ido. Some were just parts of loops or parameters etc.

    I mean i think i can shorten the results by saying if the value exists in the array already then ignore it. Otherwise store it and continue reading the line.

    But if its not just capturing what I want, its also capturing the other bits. Thats not really going to make much of a dent.

    Basically at the moment I have one program (to capture instances of include occurances within a component)

    And Now in the second program i am trying to do the same for idoc variables. The issue is, the variables can appear several times where as includes only appear once.
    So i need to somehow confine my results showing the idoc variables to make it easier to read.

    Once both programs work I will integrate them together, however for testing purposes I have kept them seperate for now.

    Attached is a copy of some of the output to the file to show what I mean.

    Java Code:
    **/
    #active.chlBusinessArea
    #active.chlLeanBusinessArea
    #active.contribMsg
    #active.docId
    #active.docId
    #active.dRevLabel
    #active.leanaccessedfilter
    #active.leanaccessedfilter
    #active.leangplfilter
    #active.leangplfilter
    #active.leanlatestfilter
    #active.leanlatestfilter
    #active.mainSectionTitle
    #active.name
    #active.networkname
    #active.networkname
    #active.q$>" class="textBoxHome advancedPadTextBox"  maxlength="<$#active.rx_search_text_max_length
    #active.q$>" style="color: Gray;" name="q" id="q" class="advancedPadTextBox_popup" onfocus="HintBox_OnFocus('oInput_txtSearch');" onblur="HintBox_OnBlur('oInput_txtSearch');" type="text"  maxlength="<$#active.rx_search_text_max_length
    #active.rx_blog_name$>&rx_user=<$#active.rx_user$>&year=<$entryYear$>&month=<$entryMonth$>" class="otherrange"><$entryMonth
    #active.rx_search_text_max_length
    #active.ssContribRegionTitle
    #active.strBusinesses
    #active.strFocusAreas
    #active.uid
    #active.xGetsClassificationType
    #active.xOriginalAuthor
    #active.xOriginalAuthor
    #active.xSector
    #env.rx_join_network_email_to$>?subject=<$#env.rx_join_network_subject$>"><img alt="RX_button-joinNetwork" src="<$HttpRelativeWebRoot
    #env.rx_join_network_intro_text$>&nbsp;<a href="#" ONMOUSEOVER="popup('<$#env.rx_join_network_help_text$>')"; ONMOUSEOUT="kill()"><img alt="rx_question_mark" src="<$HttpRelativeWebRoot
    #env.rx_suggest_network_email_to$>?subject=<$#env.rx_suggest_network_subject$>"><img alt="RX_button-suggestNetwork" src="<$HttpRelativeWebRoot
    #env.rx_suggest_network_intro_text
    #local.dID
    activeLoop="false"
    activeLoop="false"
    activeLoop="false"
    activeLoop="true"
    activeLoop="true"
    activeLoop="true"
    blogEntry
    blogEntry = ssIncInlineDynamicConversion(dDocName)
    blogEntry = ssIncInlineDynamicConversion(dDocName)
    blogEntry = ssIncInlineDynamicConversion(dDocName)
    blogEntry = ssIncInlineDynamicConversion(dDocName)
    blogEntry = ssIncludeXml(dDocName, "/Entry/node()")
    blogEntry = ssIncludeXml(dDocName, "Blog_Entry/Entry/node()")
    blogEntry = ssIncludeXml(dDocName, "Blog_Entry/Entry/node()")
    blogEntry = ssIncludeXml(dDocName, "Blog_Entry/Entry/node()")
    blogTitle
    blogTitle
    blogTitle
    blogTitle
    blogTitle = dDocTitle
    blogTitle = dDocTitle
    blogTitle = dDocTitle
    blogTitle = dDocTitle
    blogTitle = dDocTitle
    blogTitle = dDocTitle
    blogTitle = ssIncludeXml(dDocName, "/Title/node()")
    blogTitle = ssIncludeXml(dDocName, "Blog_Entry/Title/node()")
    blogTitle = ssIncludeXml(dDocName, "Blog_Entry/Title/node()")
    blogTitle = ssIncludeXml(dDocName, "Blog_Entry/Title/node()")
    blogTitle = ssIncludeXml(dDocName, "Blog_Entry/Title/node()")
    blogTitle = ssIncludeXml(dDocName, "Blog_Entry/Title/node()")
    bq = "<not> dDocType <matches> `System` <and> <not> dDocType <matches> 
    c=" a normal entry exists - no action "
    c=" A value should have been found -- this should prevent an error condition "
    c=" A value should have been found -- this should prevent an error condition, but noo change to Query "
    c=" A value should have been found -- this should prevent an error condition, but noo change to Query "
    c=" add menu option   used to test userHasRole(  rxgetinvolved_research  ) "
    c=" As you can only edit your own details, the picture must be associated with you "
    c=" Assume default is Cans query "
    c=" Must be a new user "
    c=" Must be Com Mar "
    c=" Must be Com Mar "
    c=" New image upload "
    c=" no content to display "
    c=" No entries found "
    c=" no favourtes link"
    c=" No image to display "
    c=" no menu options to show "
    c=" no return option "
    c=" Now copy back with the same criteria "
    c=" Now copy back with the same criteria "
    c=" Only checked boxes will have been passed as individual values "
    c=" Process stored my interests to convert html tag line breaks to line feeds "
    c=" rename resultset  - un-necessary as correct name in custom query"
    c=" Run the SQL query to find the final users to email  "
    c=" rx_researcher and rx_researcher_number "
    c=" save information from url for query to be used on paging display "
    c=" the new image is still being processed "
    c=" This is the default position -- assume Cans, clone code from above "
    c=" value not on URL so must be an existing image "
    c=" Value on URL means image has been changed "
    c=" values exist for this user "
    c="**  Determine if an expired content search **"
    c="**** included from separate panel *** "
    c="**** included from separate panel *** "
    c="Adds any keywords to the query"
    c="Adds any metadata query that is set. This can be in the form of dDocAuthor <matches> `sysadmin` "
    c="Appends the xProjectDevelopmentSubType value"
    c="break"
    c="break"
    c="check if user has RX_Admin_Role to access the admin functionality"
    c="check if user is already in favourites"
    c="check if user xp data file"
    c="Checks if the OR option is set, AND option is UCM by default"
    c="close off any lists leftover"
    c="close off any lists leftover"
    c="close off any lists leftover"
    c="count number of forum posts created by user"
    c="count number of forum replies posted against users forums"
    c="count the number of forum replies"
    c="create a new data file"
    c="display month, if not equal to stored month"
    c="display year, if not equal to stored year"
    c="executeService(RX_REPLY_COUNT)"
    c="executeService(RX_USER_SEARCH)"
    c="Filter list by level1 enter displayList=Consumer Insights - to only show consumer insights levels"
    c="Filter list by level1 enter displayList=Consumer Insights - to only show consumer insights levels"
    c="Filter list by level1 enter displayList=Consumer Insights - to only show consumer insights levels"
    c="get a list of people in users network "
    c="get latest revison label"
    c="get list of my networks and get forums associated with the networks"
    c="get params"
    c="get user name parameter"
    c="If the current page is > 1 display the Prev control"
    c="include rx_search_box2"
    c="javascript used to clear search field"
    c="javascript used to clear search field"
    c="javascript used to clear search field"
    c="loop email targets  "
    c="loop FavouritesDocList"
    c="Loop through all the page numbers"
    c="loop USER_RESULTSET"
    c="Not sure if required"
    c="output the next control if there are more page numbers"
    c="process content"
    c="Remove GLOBAL\ from user name"
    c="Remove GLOBAL\ from user name"
    c="Remove GLOBAL\ from user name"
    c="Remove GLOBAL\ from user name"
    c="search for post"
    c="Sets the base query"
    c="should never get here"
    c="start at the current page number - pagesEiterSideOfCurrent"
    c="store current logged in user and their rights to Gets Admin role"
    c="To pass values through the URL you must supply the query string (minus the leading &) in a variable called QueryString"
    c="To use this include you must have already run GET_SEARCH_RESULTS"
    c="Will show every other file type as it captured it from the above statements"
    c="work out forum id"
    c="workout if 'add to favourites' button should be included"
    cacheInclude("rx_cache_category_commar_list","application",300)
    cacheInclude("rx_cache_category_commar_submit","application",300)
    cacheInclude("rx_cache_category_home_competitors","application",300)
    cacheInclude("rx_cache_category_home_consumer","application",300)
    cacheInclude("rx_cache_category_home_customers","application",300)
    cacheInclude("rx_cache_category_home_markets","application",300)
    cacheInclude("rx_cache_category_home_retailers","application",300)
    cacheInclude("rx_cache_category_home_suppliers","application",300)
    cacheInclude("rx_cache_category_home_technologies","application",300)
    cacheInclude("rx_cache_category_lean_list","application",300)
    cacheInclude("rx_cache_category_lean_submit","application",300)
    currentLevel = 1
    currentLevel = 1
    currentLevel = 1
    currentLevel = currentLevel + 1
    currentLevel = currentLevel + 1
    currentLevel = currentLevel + 1
    dateSearch_q = "<and> dInDate >= `01/01/" & #active.year & " 00:00` <AND> dInDate < `01/02/" & #active.year & " 00:00`"
    dateSearch_q = "<and> dInDate >= `01/02/" & #active.year & " 00:00` <AND> dInDate < `01/03/" & #active.year & " 00:00`"
    dateSearch_q = "<and> dInDate >= `01/03/" & #active.year & " 00:00` <AND> dInDate < `01/04/" & #active.year & " 00:00`"
    dateSearch_q = "<and> dInDate >= `01/04/" & #active.year & " 00:00` <AND> dInDate < `01/05/" & #active.year & " 00:00`"
    dateSearch_q = "<and> dInDate >= `01/05/" & #active.year & " 00:00` <AND> dInDate < `01/06/" & #active.year & " 00:00`"
    dateSearch_q = "<and> dInDate >= `01/06/" & #active.year & " 00:00` <AND> dInDate < `01/07/" & #active.year & " 00:00`"
    dDocAccount:isHidden=1
    dDocAccount=""
    dDocAuthor
    dDocAuthor
    dDocAuthor
    dDocAuthor$>"><$blogTitle
    dDocAuthor$>&docId=<$dDocName$>"><$blogTitle
    dDocAuthor$>&docId=<$dDocName$>"><$forumTitle
    dDocAuthor$>&docId=<$dDocName$>"><$forumTitle
    dDocAuthor$>&docId=<$dDocName$>"><$forumTitle
    dDocAuthor$>&docId=<$dDocName$>"><$forumTitle
    dDocAuthor$>&docId=<$dDocName$>"><$forumTitle
    dDocAuthor$>&docId=<$dDocName$>"><$forumTitle
    dDocAuthor$>&rx_user=<$dUser
    dDocAuthor=dUser
    dDocName
    dDocName
    dDocName
    dDocName
    dDocName
    dDocName
    dDocName =  rx_tmp_docName
    dDocName = "XP_" & rx_dUser
    dDocName = "xu_" & strReplace(rx_user_picture,"GLOBAL\\","GLOBAL_")
    dDocName = FavouritesDocList_store.ItemId
    dDocName = rx_user_pic_name
    dDocName = rx_xp_file
    dDocName = ssBlankNewItemID
    dDocName = ssDocName
    dDocName$>"><$newsTitle
    dDocName$>?SSContributor=true"><img src="<$HttpRelativeWebRoot
    dDocName$>?xForumID=<$rx_org_docId
    dDocName$>?xForumID=<$rx_org_docId
    dDocName$>dDocTitle:<$dDocTitle$>EntryMonth:<$entryMonth
    
    
    */

  9. #9
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,412
    Rep Power
    25

    Default

    I suggest that you write a small program to read from a String using a StringReader or extract from a String[] array and scan for the data you want. The whole problem would be in a single file that you could post here for help.

  10. #10
    SwissR is offline Member
    Join Date
    Jul 2010
    Posts
    39
    Rep Power
    0

    Default

    Just a thought, could I not create an If statement along the lines of something like.

    If the arrayList already contains the values from this instance of resourceline and the value contains a symbol then call main method and continue to read document.

    Otherwise add the instance to the arrayList and trim. This should remove alot of values. But how would I go about asking if my resourceline variable contains any symbol character, is there a regex way i can do this?

    Java Code:
    [b]If arrayList already contains resourceline && If resourceline contains (any symbol)[/b]
    {
      main();
    }  
    else
    {
      resourceline=resourceline.trim;
      arrayList.add resourceline;
    }
    Last edited by SwissR; 07-26-2010 at 09:38 AM.

Similar Threads

  1. Cannot find symbol
    By SarahB in forum New To Java
    Replies: 0
    Last Post: 03-06-2010, 03:03 PM
  2. Can not find symbol ???
    By AliceNewbie in forum New To Java
    Replies: 1
    Last Post: 02-17-2010, 01:44 AM
  3. Replies: 9
    Last Post: 10-18-2008, 08:26 PM
  4. Replies: 2
    Last Post: 09-18-2008, 07:30 AM
  5. Replies: 3
    Last Post: 05-01-2008, 08:30 AM

Posting Permissions

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