Hi, @claudia-frank,
In other words, considering the general case, we have to search for C text, between two limits A and B
But, how to define text, which is between these two limits ? Well, simply, because, at ANY location reached :
A limit A must not be found, further on, in the same line
A limit B must be found, further on, in the same line
This implies the two conditions to respect :
The negative look-ahead (?!.*?A)
The positive look-ahead (?=.+?B)
In our particular case :
Limit A is the string "file:\x2F\x2F ( \x2F represents the normal slash character, / )
Limit B is the simple ending " character
And, of course, C is the regex to get special characters [^\w:/.]
Just notice that we could swap the two lookarounds, without any problem ! Remember that, at any location, reached by the regex engine, the two conditions, resulting of the look-arounds, are, necessarily, both, evaluated !
Thus, the complete search regex (?-is)(?=.+?")(?!.*?"file:\x2F\x2F)[^\w:/.], correctly, find the same special characters, as in my previous post !
Now, using the example text, below :
A sim^ple tes#t "file://^598C308F;75D2A1D485#22405CE21918@E94D6475FC22E^pimgpsh_thumbnail_win_distr.jpg" A si;mple Te@stAs long as the current regex engine location is before the string "file:…, the negative look-ahead (?!.*?"file:\x2F\x2F) is not true, so no overall match is possible, whatever the text C searched
As soon as the current regex engine location is at the ending " double quote, or further on, the positive look-ahead (?=.+?") is false, so no overall match is possible, too, whatever the text C searched
But, when the current regex engine location is, BOTH, right after the "file:… string AND before the ending " double quote, the two conditions are, simultaneously, TRUE. So, an overall match may be found, providing it, also, matches the C text. That is to say, the regex [^\w:/.]
Cheers,
guy038
P.S. :
Note that when the current regex engine location is right after the starting double quote, the negative look-ahead (?!.*?"file:\x2F\x2F), this time, is true. So, we need to include the semicolon and the slash, as regular characters. Otherwise, they would be found and deleted, as well as the dot character !