Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: help with regex

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default help with regex

    Hi, to try and save some time I was wondering if anyone here could help me? Currently I am using .trim() to get rid of any white space before or after the current line being looked at. Then I want to split the line and put the parts I want into the array:

    theLine = theLine.trim();
    String [] tokens = theLine.split("\\s+"); //obviously I need to replace "\\s+" with something else


    here is an example of what I need to parse and the pieces i'm trying to get:
    I am trying to get "sept 1, 2010" in the first cell of the array. Then 12,9,18,11,19,5
    any help would be awesome!

    </TR>


    <TR class="general_odd_row">
    <TD class="historic data">Sept 1, 2010</TD>
    <TD align="center" class="crap_I_dont_want text_align_center" >12</TD>
    <TD align="center" class="crap_I_dont_want" >9</TD>
    <TD align="center" class="crap_I_dont_want" >18</TD>
    <TD align="center" class="crap_I_dont_want" >11</TD>
    <TD align="center" class="crap_I_dont_want" >19</TD>
    <TD align="center" class="crap_I_dont_want" >5</TD>

    </TR>



    sooo..... <TD blah blah> stuff I need </TD>


  2. #2
    Forum VIP
    Join Date
    Oct 2010
    Posts
    275
    My Mood
    Cool
    Thanks
    32
    Thanked 54 Times in 47 Posts
    Blog Entries
    2

    Default Re: help with regex

    Take a look at Lesson: Regular Expressions (The Java™ Tutorials > Essential Classes) and take not that the information you want starts with >, and ends with <.

Similar Threads

  1. need help with regex
    By o2a1 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: February 13th, 2011, 08:50 AM
  2. [SOLVED] Java Regex Help
    By newbie in forum Java Theory & Questions
    Replies: 7
    Last Post: January 26th, 2011, 09:01 AM
  3. Need help with Regex
    By snytkine in forum Java Theory & Questions
    Replies: 4
    Last Post: October 12th, 2010, 08:30 AM
  4. Need help with regEx
    By ptabatt in forum What's Wrong With My Code?
    Replies: 4
    Last Post: August 14th, 2010, 12:17 PM