.net - Regex to match word including the surrounding square brackets -


in following text, want match first [id], not second [id] part of [something].[id]
edit: actual text include square brackets. need match surrounding brackets well.

match [id] don't match [something].[id]

i used following regex, doesn't match anything.

\b\[id\] 

why regex not working , what's correct one?

thanks.

as far i'm aware, \b doesn't match beginning of string. try:

(^|[\w])\[id\] 

as regex instead.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -