Wednesday, November 21, 2012

Search and Replace for Brackets [] in Access

I use Microsoft Access as a front end for SQL Server databases.  There are some good reasons for this that I don't want to get into now.  One reason I will reveal is the table view.  You can open a table, view the data, sort, filter, and search and replace on the table just like it was a regular access database.

I needed to do a search and replace on all instances of "[code]" and "[/code]" in a field.  However, a generic search for either would fail.  Apparently, the characters "[" and "]" initiate what seems to be a regex search.

Fortunately, I found this message thread that contained a way to perform the search and replace.  It was not an easy find.

In order to search for "[code]", the following has to be entered into the dialog box:  "[[]code[]]".  To search for "[/code]", the following has to be entered:  "[[]/code[]]".

By using these, everything worked fine.