I need regex to find words starting, for example, whith letters "B" or "b". In sentence Bword abword bword
I need to find Bword
and bword
.
My curresnt regex is: [Bb]\w+
(first character is space), but it doesn't find Bword
.
Thanks in advance.
Try using following regex: (?i)\bB\w*\b
It means:
(?i)
- turn on ignore case option\b
- first or last character in a wordB
\w*
- Alphanumeric, any number of repetitions\b
- first or last character in a wordSo it will find Bword
and bword
.