On Thursday, January 30, 2020 at 1:26:47 PM UTC-8, Jefferis Peterson wrote: > > Thank you GP That worked very well for 80 links, but i found another > set of links masked by making the text invisible in the posts... > >> <a style="text-decoration:none; color: #f9f9f9;" href=" >>> http://alwaysvaltrexonline.com">buy valtrex online</a> >>> >> > There are 3 variations... the addition of colons in the style, and the > addition of the color# and instead of using a single period to disguise > it, they have put in full text in the link > > I tried to modify what you did but nothing I did seemed to work. > This is the closest to what you did I thought: I thought that this > set of characters would find any text: [^”]* So i added it where the > strings were for color and link text, but it did not find these type of > strings: >
[^”]* isn't any text; rather, any text BUT a quote character. > <a style="text-decoration:none[^”]*" href=“[^”]*”>[^”]*<\/a> >> > > Can you tell me what I did wrong? And are spaces ignored in the string? > Somehow you got typograher's [curly] quotes in your [^”]* additions; whereas, the text you're trying to match has straight quotes. So the first [^”]* greedily consumes all the remaining text because there's no curly quote to be found leaving nothing available to match the rest of the regular expression. (There is one exception when the last text in the database matches href=“[^”]*”>[^”]*<\/a> trailing part of the regular expression.) Second, using [^”]* in the ”>[^”]*<\/a> portion doesn't stop text matching consumption when the </a> tag is encountered. You don't want to match everything but a quote character; instead, you want to match everything but a < character (which will leave unconsumed any </a> text for subsequent matching the <\/a> regular expression part). Fixing those issues yields: <a style="text-decoration:none[^"]*" href="[^"]*">[^<]+<\/a> With the [^<]+, I'm assuming you're always going to have at least one character between the > </a> text pattern in the bogus links you're trying to get rid of. If that isn't true you can change the + to a * which will allow a match even if there isn't a character in that position. Supplementing the test text with the additional HTML example: test text text preceeding <a style="text-decoration:none" href="/ansaid-retail-cost">.</a> text succeeding <a style="text-decoration:none" href="/ansaid-retail-cost">.</a> <a style="text-decoration:none; color: #f9f9f9;" href="http://alwaysvaltrexonline.com">buy valtrex online</a> text preceeding <a style="text-decoration:none" href="/ansaid-retail-cost">.</a> text succeeding <a style="text-decoration:none" href="/ansaid-retail-cost">.</a> and applying the revised regular expression yields: test text text preceeding text succeeding text preceeding text succeeding -- This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "[email protected]" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/5803e65b-6177-4282-aefc-5616c2085f4c%40googlegroups.com.
