Results 1 to 2 of 2
  1. #1
    kovitch is offline Member
    Join Date
    Sep 2011
    Rep Power

    Default Regular expressions (REGEX)


    I'm trying to make a regular expression for 2 kinds of situation (on with link on the other without):

    Java Code:
    1:  <td class="nfo">microSD, up to 32GB, <a href= target=_blank>buy memory</a></td></tr>
    2:  <td class="nfo">microSD, up to 16GB</td></tr>
    The regular expression that I have is:

    Java Code:
    p_spec = Pattern.compile("<td[\\s]class=\"nfo\">(.+?)(,\\s)(?i)<a([^>]+)>(.+?)</a></td>");
    When the expression is used in the 1st piece of code the result i got (applying p_spec.matcher("")) is: "microSD, up to 32GB".
    When I use the expression in the 2nd piece of code I don't get any result at all.

    How can I change the regular expression in order to get info from the 1st and the 2nd lines?

    Best regards.

  2. #2
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Rep Power

    Default Re: Regular expressions (REGEX)

    Look at this.
    I think you can figure out it yourself.
    Skype: petrarsentev

Similar Threads

  1. Regular Expressions Help
    By Death Sickle in forum New To Java
    Replies: 4
    Last Post: 04-04-2011, 04:21 AM
  2. Regular Expressions problem
    By mohammedelbes in forum Advanced Java
    Replies: 7
    Last Post: 01-05-2011, 12:12 PM
  3. regular expressions
    By sozeee in forum New To Java
    Replies: 3
    Last Post: 12-06-2010, 10:58 PM
  4. Regular Expressions in java
    By blue404 in forum Advanced Java
    Replies: 2
    Last Post: 09-26-2008, 03:43 AM
  5. Handling regular expressions using Regex
    By Java Tutorial in forum Java Tutorial
    Replies: 0
    Last Post: 01-07-2008, 01:46 PM

Posting Permissions

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