Results 1 to 2 of 2
Thread: Regular expressions (REGEX)
- 09-23-2011, 12:48 PM #1
Member
- Join Date
- Sep 2011
- Posts
- 1
- Rep Power
- 0
Regular expressions (REGEX)
Hi,
I'm trying to make a regular expression for 2 kinds of situation (on with link on the other without):
The regular expression that I have is:Java Code:1: <td class="nfo">microSD, up to 32GB, <a href=http://a.gsmarena.com/adclick.php?bannerid=137&zoneid=9&source=&dest=http%3A%2F%2Fgsmarena.pgpartner.com%2Fsearch_attrib.php%2Fpage_id%3D152%2Fpopup1%5B%5D%3D75%3A105 target=_blank>buy memory</a></td></tr> or 2: <td class="nfo">microSD, up to 16GB</td></tr>
When the expression is used in the 1st piece of code the result i got (applying p_spec.matcher("")) is: "microSD, up to 32GB".Java Code:p_spec = Pattern.compile("<td[\\s]class=\"nfo\">(.+?)(,\\s)(?i)<a([^>]+)>(.+?)</a></td>");
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.
- 09-23-2011, 12:57 PM #2
Re: Regular expressions (REGEX)
Hi
Look at this. Help with Regex to get only <td></td> and the text within it in a <table> tag
I think you can figure out it yourself.Skype: petrarsentev
http://TrackStudio.com
Similar Threads
-
Regular Expressions Help
By Death Sickle in forum New To JavaReplies: 4Last Post: 04-04-2011, 04:21 AM -
Regular Expressions problem
By mohammedelbes in forum Advanced JavaReplies: 7Last Post: 01-05-2011, 11:12 AM -
regular expressions
By sozeee in forum New To JavaReplies: 3Last Post: 12-06-2010, 09:58 PM -
Regular Expressions in java
By blue404 in forum Advanced JavaReplies: 2Last Post: 09-26-2008, 03:43 AM -
Handling regular expressions using Regex
By Java Tutorial in forum Java TutorialReplies: 0Last Post: 01-07-2008, 12:46 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks