Copy link to clipboard
Copied
It seems like you can't tell the difference in general.
Once I found the difference, it seems that one contains boundaries while the other only contains in-bounds.
I can't find an obvious example.
In InDesign GREP, \b means a word boundary. It matches places where a word starts or ends, but it's quite picky. It only sees letters, numbers and underscores as part of a word. So if you search for \bword\b, it will find the word "word" by itself, but not "word1" or "word-2", because those are seen as longer or different words.
\< means the start of a word and \> means the end of a word. These two are more flexible. \<word will find "word", "word1", "word-2", even "word_3". It just cares that
...I seem to know roughly the difference between \< \> and \b.
\< \> is bounded by (but not including) the punctuation or \s.
\b is bounded by the left and right of the punctuation or \s.
Use these two to see the difference:
(? <=\<). +? (? =\>)
(? <=\b). +? (? (=\b)
There is no difference in general use.
Copy link to clipboard
Copied
In InDesign GREP, \b means a word boundary. It matches places where a word starts or ends, but it's quite picky. It only sees letters, numbers and underscores as part of a word. So if you search for \bword\b, it will find the word "word" by itself, but not "word1" or "word-2", because those are seen as longer or different words.
\< means the start of a word and \> means the end of a word. These two are more flexible. \<word will find "word", "word1", "word-2", even "word_3". It just cares that the word starts with "word".
And if you pair them up like \<word.+?\>, it’ll find the full stretch of text starting with "word" and ending at the edge of the word, even if it’s got dashes, numbers or underscores in it.
So, if you’re trying to match full words that start with "word", go with \< and \>. If you only want the pure word "word" with nothing stuck to it, go with \b.
Simple rule
Use \b when you want the exact word.
Use \< and \> when you want the start and end of bigger words.
Copy link to clipboard
Copied
It doesn't seem all right.
In general there is no difference between \bword\b and \<word\>.
\<word also can't match word2
Copy link to clipboard
Copied
Here's a visual for you
So \bword\ only cares about 'word'
\<word\> cares about the entire text beyond words
\b specifies a boundary
\< \> specifies location - it's a bit greedy because I haven't specified -1 or _2 but because it starts with word it's including everything from beginning of word up to the end of the word - as it sees - and _ as part of the word.
\b doesn't
 
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Maybe a language thing - I'm not saying you'll get the same results - I'm showing the differences the searches can make and how 1 or the other can show different results.
Maybe rules are different in different languages.
Copy link to clipboard
Copied
Your explanation at the top is probably right.
A long time ago, I really saw the difference between them, but I can't give that example now.
It's depressing.
Copy link to clipboard
Copied
I seem to know roughly the difference between \< \> and \b.
\< \> is bounded by (but not including) the punctuation or \s.
\b is bounded by the left and right of the punctuation or \s.
Use these two to see the difference:
(? <=\<). +? (? =\>)
(? <=\b). +? (? (=\b)
There is no difference in general use.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now