(?<=) and (?=) are called assertions ("atomic" elements are an entirely different matter) and they are essentially the same sort of thing as \b, in that they do not consume
characters when matching: meaning that another part (earlier or later) of the pattern can match the same characters that were matched by the assertions.
Another way to look at assertions is to treat them as positions
, ie assertions match a position in the input that is preceded or followed by whatever is inside the assertion. Sort of like the cursor in an editbox: a cursor can be put anywhere in the string, but it's always between
characters. In contrast, "normal" regex patterns can be thought of as a selected area of text in an editbox. A selection always covers one or more characters.
Assertions can be a little hard to get at first (although they are straightforward in reality) and this is not the place for a full explanation, examples etc. This tutorial
should be helpful.
The reason I used assertions instead of (?:) will become apparent if your expressions use the /g modifier. In such cases, the same part of the input can match an assertion in more than one /g rounds, for example once in a lookahead, in one round, and a second time in a lookbehind, in the next round. Not sure how much of this makes sense now, but I hope it will once you read the tutorial and play with some examples yourself.