Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Microsoft has a nifty quick reference card for .Net Regular Expressions.

But it seems to list \b as both matching Backspace and also matching "On word boundary".

Which is it? Can \b really do both? How can you be precise about which one you mean?

share|improve this question

closed as off-topic by slhck Jun 20 '14 at 6:15

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question is not about computer hardware or software, within the scope defined in the help center." – slhck
If this question can be reworded to fit the rules in the help center, please edit the question.

I'm not sure why you asked a C#/.Net question here when you have 27k on Stack Overflow where this belongs, topically. – slhck Jun 20 '14 at 6:16
The Visual Studio IDE amd Powershell both use .Net expressions. I came across this question in the context of using the IDE. Searching and Editing files is more of a SuperUser task than a programming problem. – abelenky Jun 20 '14 at 9:04
I see, thanks. Maybe you can clarify the context, e.g. show a screenshot of the IDE or explain the searching files part? Then I'd say it's fine to stay here. – slhck Jun 20 '14 at 9:12

\b means "word boundary" outside of character classes (also called character sets) and "backspace" inside character classes.

Here it means a word boundary:


Here it means a backspace


See this Microsoft reference: Character Escapes in Regular Expressions.
PERL regex has the same definition for \b.

share|improve this answer
Agreed, per this reference: – Mark Allen Jun 19 '14 at 21:48
@MarkAllen: Added your link to my post. Thanks. – Olivier Jacot-Descombes Jun 19 '14 at 21:58
From a quick LinqPad check, \b is the only \[a-zA-Z] that is defined for both a standalone backslash and as a character class that returns a different match set. – Mark Hurd Jun 20 '14 at 3:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.