Page 1 of 1

Dot Matches Newline not working on regex

Posted: Mon Aug 26, 2024 1:32 pm
by jambajuicemain
I'm trying to find and a replace matches for the following regex pattern using the "Dot Matches Newline" flag but am getting the error message...
Error in Find: Specified argument was out of the range of valid values. My understanding is that Text Crawler uses .NET regex engine so the "Dot Matches Newline" checkbox that I have checked should work for "Single line" as shown in Regex01

The regex pattern is proven to work in reg101 - https://regex101.com/r/9Y2Gfy/1

Code: Select all

regex: ^(.*?(?:@heroImageURL\s*=\s*""[^""]+"".*?){1}@heroImageURL\s*=\s"")[^""]+(?="")
test string:

Code: Select all

 IF @brandName == "A" THEN
       set @heroImageURL = "http://www.image.com/a9230239u230.jpg"
       set @productImageURL = "http://www.image.com/A29200923.jpg"
    ELSEIF @brandName == "B" THEN
       set @heroImageURL = "http://www.image.com/b2389823u238.jpg"
       set @productImageURL = "http://www.image.com/B22392029.jpg"
    ELSEIF @brandName == "C" THEN
       set @heroImageURL = "http://www.image.com/c23892389289.jpg"
       set @productImageURL = "http://www.image.com/C49309934.jpg"
    ELSEIF @brandName == "D" THEN
       set @heroImageURL = "http://www.image.com/d23423892833.jpg"
       set @productImageURL = "http://www.image.com/D09349409.jpg"
    ELSEIF @brandName == "E" THEN
       set @heroImageURL = "http://www.image.com/e22823889899.jpg"
       set @productImageURL = "http://www.image.com/E22092309.jpg"
    ELSE
       set @heroImageURL = "http://www.image.com/e22823889899.jpg"
       set @productImageURL = "http://www.image.com/E22092309.jpg"
    ENDIF

Code: Select all

Substitution: $1http://www.google.com/1.jpg

Re: Dot Matches Newline not working on regex

Posted: Mon Aug 26, 2024 3:03 pm
by DigitalVolcano
Try unchecking 'ECMA compatibility' in the settings - this can cause that error.

Also note that TextCrawler uses .NET 4.5. regular expressions, not .NET 7 as used in regex101