Hi. I've started to learn java 3 days ago. I need something similar to preg_match_all from php I found regex class but can you give me an example because I'm really new. Thank you
Java SE (by Sun) Anyway I found what i was looking for but i have a small question because i see that is a little different from php and i don't know why because in the class refference it looks ok so... I want to grab the image url from a html page If i use the pattern <img src='(.*)'> it return the entire line some text <img src='dir file'> another text <img src='file'> but if i use it returns ok if the src doesnt contain any spaces so my question is why the .* is not working? on sun page http://java.sun.com/docs/books/tutorial/essential/regex/pre_char_classes.html it shows me that Thank you
A bit late, but maybe that could be usefull for someone else : Pattern p = Pattern.compile("<img [^>]*src=[\"|']([^(\"|')]+)[\"|'][^>]*>"); Matcher m = p.matcher(cnt); while(m.find()) { System.out.println(m.group(1)); } Code (markup):