Copy link to clipboard
Copied
Simple TextFrame with text:
" o o o o o o "
Try Find/Change and search for " o " - how many search results you'll get when you click FIND NEXT ?
Same problem when searching through Script ...
Or am I missing something ??
...
The same problem is with FireFox - screen from the current post:
WORD have the samme problem ??
Copy link to clipboard
Copied
That does not look right. GREPXtra finds them.
Copy link to clipboard
Copied
There are spaces between "o"s.
Copy link to clipboard
Copied
I think you're expecting the space characters in the search to overlap.
In a string such as 'o-o-o-o-o-o' (with dashes standing in for spaces) there are only two examples of the string '-o-' as literals. Search doesn't start over and find the overlapping spaces for that.
Or did I miss your point?
Copy link to clipboard
Copied
Yeah, maybe that's how it should work ...
Copy link to clipboard
Copied
That is the behaviour I expect and I wouldn't want it any other way. Consider the common practice of searching for double linebreaks and replacing with a single linebreak: the difference between find \r\r (finds 2 linebreaks) and \r\r+ (finds two or more linebreaks). This distinction would go away if the find function worked the way you imply.
Another way to put it is: the find function interpreter advances to the end of the last match each time; it does not start again from the beginning, or look behind (unless grep deliberately asks it to).
- Mark
Copy link to clipboard
Copied
Makes sense ... kind of ... but I'm looking for " o " - not "oo" - so every possible combination should be found and returned ?
Copy link to clipboard
Copied
Not every combination, not with Search. Maybe with variations of GREP.
But 'oooooooooooo' would only return four instances of 'ooo,' not... some factorial multiple.
Copy link to clipboard
Copied
Looks like it works as it supposed to work ...
If we have " o o o o o " - and then we start changing them to "-o-":
"-o-o o o o "
the 2nd " o " no longer exists as it's now "-o "
Copy link to clipboard
Copied
Text search engines work with internal pointers and consume characters while processing the stream. When a match is found, the pointer advances next to that match. And that's usually what users expect, in particular when replacements are involved. Breaking this rule would have serious consequences on many programs.
Now you can still prevent a search from consuming characters, using lookbehind/lookahead assertions. In your example, each 'o' preceded and followed by a space can still be captured (and changed) using a GREP pattern like (?<= )o(?= ).
Marc