It doesn't match for two reasons:
1 - String.matches() returns true if the the entire String is matched by the regex. Since your regex stops after href=\", it won't match the entire String. Try adding another DOT-STAR at the end of your regex;
2 - there are two spaces in this part of your regex: <a .* href (before and after the DOT-STAR) while there is only one space in your text.
Another thing, matching text with DOT-STAR should be avoided if you can. Be more specific where possible. So you shouldn't do:
prometheuzz wrote:It doesn't match for two reasons:
1 - String.matches() returns true if the the entire String is matched by the regex. Since your regex stops after href=\", it won't match the entire String. Try adding another DOT-STAR at the end of your regex;
2 - there are two spaces in this part of your regex: <a .* href (before and after the DOT-STAR) while there is only one space in your text.
Another thing, matching text with DOT-STAR should be avoided if you can. Be more specific where possible. So you shouldn't do:
1. I had tried something like that in earlyer examples but still didnt get any success.
2. Thats because some links i am going through start the tag with <a id="1234abc" href="...
3. I had read it was greedy with memory using .* but just for getting used to regex i would use something simple but thanks for the tip.
prometheuzz wrote:It doesn't match for two reasons:
1 - String.matches() returns true if the the entire String is matched by the regex. Since your regex stops after href=\", it won't match the entire String. Try adding another DOT-STAR at the end of your regex;
2 - there are two spaces in this part of your regex: <a .* href (before and after the DOT-STAR) while there is only one space in your text.
Another thing, matching text with DOT-STAR should be avoided if you can. Be more specific where possible. So you shouldn't do:
1. I had tried something like that in earlyer examples but still didnt get any success.
2. Thats because some links i am going through start the tag with <a id="1234abc" href="...
3. I had read it was greedy with memory using .* but just for getting used to regex i would use something simple but thanks for the tip.