Mark Read Well-Known Member Licensed User Longtime User Dec 9, 2012 #1 I have a text line read from a HTML page, example: Code: Copy line="<p><a href="thumbs/leralyn-1-7892.jpg"><img alt="" src="thumbs/leralyn-1.jpg" border="2" height="284" width="200"></a><br>" I want to extract the filename and have been using the FlickrViewer as basic code. I have only made a few minor changes to the HandleMainPage sub. My catch pattern is as follow: Code: Copy pattern="<a href=qthumbs/\w+\.jpgq".Replace("q", QUOTE) '<a href="thumbs/somename.jpg"> The regex command should pull out the filename as commented in pattern above. Code: Copy m = Regex.Matcher(pattern, line) The problem is that it doesn't work, my pattern is wrong. I have traced the problem to the "-" in the filename but I cannot change this, the files are on a public server. Using a workaround I replaced the "-" with a "_" and then everything works. Does anyone have a better mask for the pattern variable? Thanks, Mark
I have a text line read from a HTML page, example: Code: Copy line="<p><a href="thumbs/leralyn-1-7892.jpg"><img alt="" src="thumbs/leralyn-1.jpg" border="2" height="284" width="200"></a><br>" I want to extract the filename and have been using the FlickrViewer as basic code. I have only made a few minor changes to the HandleMainPage sub. My catch pattern is as follow: Code: Copy pattern="<a href=qthumbs/\w+\.jpgq".Replace("q", QUOTE) '<a href="thumbs/somename.jpg"> The regex command should pull out the filename as commented in pattern above. Code: Copy m = Regex.Matcher(pattern, line) The problem is that it doesn't work, my pattern is wrong. I have traced the problem to the "-" in the filename but I cannot change this, the files are on a public server. Using a workaround I replaced the "-" with a "_" and then everything works. Does anyone have a better mask for the pattern variable? Thanks, Mark
Erel B4X founder Staff member Licensed User Longtime User Dec 10, 2012 #2 Change \w+ to [\w-]+ Upvote 0
Mark Read Well-Known Member Licensed User Longtime User Dec 11, 2012 #3 @Erel If only life was as simple as your answers. Thanks, works a dream. :sign0142: Upvote 0